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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5bbda34bec628821cb2c1cafb031bb405a2a9a9
4
- data.tar.gz: a92a1ee8a19c7268c005067428c71c123595dd9f
3
+ metadata.gz: 5f2bc87bc70a1e81d27afec78d623ef6eaf0172d
4
+ data.tar.gz: e7601bac5af7d3baa442f745ffc25979252e7e2e
5
5
  SHA512:
6
- metadata.gz: 398792f479884ca19c683fc154e49c0585d8abe993fb4c2c0be8301b783d81035bf5a24018b4059ef8acc9c541527099c277d84637d80bbd7ef79730ab1bcd0a
7
- data.tar.gz: ce5926840c2fed1cba4b62920f7101b67c4f16e38501dc89c8a88908ee0dd69f0f22a970a7acb5e757dfde7c7f123801a054897a6eda86af1f2c8cccf79b5f3e
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/activerecord3.gemfile"
9
- - "gemfiles/activerecord4.gemfile"
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 "activerecord3" do
2
- gem "activerecord", "3.2.14"
1
+ appraise "activerecord30" do
2
+ gem "activerecord", "3.2.21"
3
3
  end
4
4
 
5
- appraise "activerecord4" do
6
- gem "activerecord", "4.0.2"
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.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
- TODO: Write usage instructions here
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
 
@@ -3,6 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "activerecord", "4.0.2"
6
+ gem "activerecord", "3.2.21"
7
7
 
8
- gemspec :path=>"../"
8
+ gemspec :path => "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "activerecord", "4.0.13"
7
+
8
+ gemspec :path => "../"
@@ -3,6 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "activerecord", "4.1.1"
6
+ gem "activerecord", "4.1.10"
7
7
 
8
8
  gemspec :path => "../"
@@ -3,6 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "appraisal"
6
- gem "activerecord", "3.2.14"
6
+ gem "activerecord", "4.2.1"
7
7
 
8
- gemspec :path=>"../"
8
+ gemspec :path => "../"
@@ -6,8 +6,8 @@ module ScopedAssociations
6
6
  super + [:scoped]
7
7
  end
8
8
 
9
- def build(attributes = {})
10
- reflection = ActiveRecord::VERSION::MINOR == 0 ? super() : super(attributes)
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
@@ -1,4 +1,4 @@
1
1
  module ScopedAssociations
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
4
4
 
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.required_ruby_version = ">= 1.9.3"
28
28
 
29
- spec.add_dependency 'activerecord', ['>= 3.2', '< 4.2']
29
+ spec.add_dependency 'activerecord', ['>= 3.2', '< 4.3']
30
30
  spec.add_dependency 'activesupport'
31
31
  end
32
32
 
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
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: 2014-06-12 00:00:00.000000000 Z
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.2'
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.2'
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/activerecord3.gemfile
133
- - gemfiles/activerecord4.gemfile
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/fixtures/image.png
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/fixtures/image.png
172
- - spec/image_spec.rb
171
+ - spec/integration_spec.rb
173
172
  - spec/spec_helper.rb
Binary file