scoped_associations 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -2
- data/Appraisals +9 -5
- data/README.md +29 -1
- data/gemfiles/{activerecord4.gemfile → activerecord30.gemfile} +2 -2
- data/gemfiles/activerecord40.gemfile +8 -0
- data/gemfiles/activerecord41.gemfile +1 -1
- data/gemfiles/{activerecord3.gemfile → activerecord42.gemfile} +2 -2
- data/lib/scoped_associations/activerecord4/has_one.rb +6 -2
- data/lib/scoped_associations/version.rb +1 -1
- data/scoped_associations.gemspec +1 -1
- data/spec/{image_spec.rb → integration_spec.rb} +0 -0
- metadata +29 -30
- data/spec/fixtures/image.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f2bc87bc70a1e81d27afec78d623ef6eaf0172d
|
4
|
+
data.tar.gz: e7601bac5af7d3baa442f745ffc25979252e7e2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f00d2ae4edca75d2ff8eb6b46cc5c2151c035b018e99ae77b3795f934773d8676bbcfdb8e6b149059ab5e963c7e6b6d1cd1ba07fcc3c145e72d2c293738c73d3
|
7
|
+
data.tar.gz: e60442bf36f1f03f851faa29f1d5a571efaf2bd5a4a054c92aa36d9773a9d87566cbbc7fa085016d47651b26abcfb6c993a82aecca644adfae8c7dff03c16171
|
data/.travis.yml
CHANGED
@@ -3,10 +3,18 @@ language: ruby
|
|
3
3
|
rvm:
|
4
4
|
- "1.9.3"
|
5
5
|
- "2.0.0"
|
6
|
+
- "2.2.2"
|
6
7
|
|
7
8
|
gemfile:
|
8
|
-
- "gemfiles/
|
9
|
-
- "gemfiles/
|
9
|
+
- "gemfiles/activerecord30.gemfile"
|
10
|
+
- "gemfiles/activerecord40.gemfile"
|
11
|
+
- "gemfiles/activerecord41.gemfile"
|
12
|
+
- "gemfiles/activerecord42.gemfile"
|
13
|
+
|
14
|
+
matrix:
|
15
|
+
exclude:
|
16
|
+
- rvm: "2.2.2"
|
17
|
+
gemfile: "gemfiles/activerecord30.gemfile"
|
10
18
|
|
11
19
|
script: "bundle exec rake spec"
|
12
20
|
|
data/Appraisals
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
-
appraise "
|
2
|
-
gem "activerecord", "3.2.
|
1
|
+
appraise "activerecord30" do
|
2
|
+
gem "activerecord", "3.2.21"
|
3
3
|
end
|
4
4
|
|
5
|
-
appraise "
|
6
|
-
gem "activerecord", "4.0.
|
5
|
+
appraise "activerecord40" do
|
6
|
+
gem "activerecord", "4.0.13"
|
7
7
|
end
|
8
8
|
|
9
9
|
appraise "activerecord41" do
|
10
|
-
gem "activerecord", "4.1.
|
10
|
+
gem "activerecord", "4.1.10"
|
11
|
+
end
|
12
|
+
|
13
|
+
appraise "activerecord42" do
|
14
|
+
gem "activerecord", "4.2.1"
|
11
15
|
end
|
12
16
|
|
data/README.md
CHANGED
@@ -22,7 +22,35 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
Just add `scoped: true` to your relation macro:
|
26
|
+
|
27
|
+
```
|
28
|
+
class Post < ActiveRecord::Base
|
29
|
+
has_one :primary_tag,
|
30
|
+
as: :owner,
|
31
|
+
class_name: "Tag",
|
32
|
+
scoped: true
|
33
|
+
|
34
|
+
has_many :primary_tags,
|
35
|
+
as: :owner,
|
36
|
+
class_name: "Tag",
|
37
|
+
scoped: true
|
38
|
+
end
|
39
|
+
|
40
|
+
## Running tests
|
41
|
+
|
42
|
+
Install gems:
|
43
|
+
|
44
|
+
```
|
45
|
+
$ bundle
|
46
|
+
$ bundle exec appraisal
|
47
|
+
```
|
48
|
+
|
49
|
+
Launch tests:
|
50
|
+
|
51
|
+
```
|
52
|
+
bundle exec appraisal rake
|
53
|
+
```
|
26
54
|
|
27
55
|
## Contributing
|
28
56
|
|
@@ -6,8 +6,8 @@ module ScopedAssociations
|
|
6
6
|
super + [:scoped]
|
7
7
|
end
|
8
8
|
|
9
|
-
def build(
|
10
|
-
reflection =
|
9
|
+
def build(*args)
|
10
|
+
reflection = super
|
11
11
|
extend_reflection(reflection)
|
12
12
|
reflection
|
13
13
|
end
|
@@ -49,6 +49,10 @@ module ScopedAssociations
|
|
49
49
|
def association_scope
|
50
50
|
super.where(reflection.foreign_scope => reflection.name.to_s)
|
51
51
|
end
|
52
|
+
|
53
|
+
def target_scope
|
54
|
+
super.where(reflection.foreign_scope => reflection.name.to_s)
|
55
|
+
end
|
52
56
|
end
|
53
57
|
end
|
54
58
|
end
|
data/scoped_associations.gemspec
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,117 +1,117 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scoped_associations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sqlite3
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: coveralls
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: activerecord
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3.2'
|
90
|
-
- - <
|
90
|
+
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: '4.
|
92
|
+
version: '4.3'
|
93
93
|
type: :runtime
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- -
|
97
|
+
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '3.2'
|
100
|
-
- - <
|
100
|
+
- - "<"
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '4.
|
102
|
+
version: '4.3'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: activesupport
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
description: ScopedAssociations lets you create multiple `has_to` and `has_many` associations
|
@@ -122,16 +122,17 @@ executables: []
|
|
122
122
|
extensions: []
|
123
123
|
extra_rdoc_files: []
|
124
124
|
files:
|
125
|
-
- .gitignore
|
126
|
-
- .travis.yml
|
125
|
+
- ".gitignore"
|
126
|
+
- ".travis.yml"
|
127
127
|
- Appraisals
|
128
128
|
- Gemfile
|
129
129
|
- LICENSE.txt
|
130
130
|
- README.md
|
131
131
|
- Rakefile
|
132
|
-
- gemfiles/
|
133
|
-
- gemfiles/
|
132
|
+
- gemfiles/activerecord30.gemfile
|
133
|
+
- gemfiles/activerecord40.gemfile
|
134
134
|
- gemfiles/activerecord41.gemfile
|
135
|
+
- gemfiles/activerecord42.gemfile
|
135
136
|
- lib/scoped_associations.rb
|
136
137
|
- lib/scoped_associations/activerecord3/has_many.rb
|
137
138
|
- lib/scoped_associations/activerecord3/has_one.rb
|
@@ -139,8 +140,7 @@ files:
|
|
139
140
|
- lib/scoped_associations/activerecord4/has_one.rb
|
140
141
|
- lib/scoped_associations/version.rb
|
141
142
|
- scoped_associations.gemspec
|
142
|
-
- spec/
|
143
|
-
- spec/image_spec.rb
|
143
|
+
- spec/integration_spec.rb
|
144
144
|
- spec/spec_helper.rb
|
145
145
|
homepage: https://github.com/stefanoverna/scoped_associations
|
146
146
|
licenses:
|
@@ -152,12 +152,12 @@ require_paths:
|
|
152
152
|
- lib
|
153
153
|
required_ruby_version: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- -
|
155
|
+
- - ">="
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: 1.9.3
|
158
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
159
|
requirements:
|
160
|
-
- -
|
160
|
+
- - ">="
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
@@ -168,6 +168,5 @@ specification_version: 4
|
|
168
168
|
summary: Create multiple `has_to` and `has_many` associations between two ActiveRecord
|
169
169
|
models
|
170
170
|
test_files:
|
171
|
-
- spec/
|
172
|
-
- spec/image_spec.rb
|
171
|
+
- spec/integration_spec.rb
|
173
172
|
- spec/spec_helper.rb
|
data/spec/fixtures/image.png
DELETED
Binary file
|