active_record_inherit_assoc 2.2.1 → 2.3.0

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: df1b44b0b9255a29b797c8867e334c15b4ccff07
4
- data.tar.gz: 998fd258d644d42b7136bab89bfc2d91c205c407
3
+ metadata.gz: 8b2f250ef399ae8537b97564081cfea7d4a73a2a
4
+ data.tar.gz: b4025d0dcabfe02ff6bddf3aa8219938896267f5
5
5
  SHA512:
6
- metadata.gz: e7cb32c32626162fe0a9d0de90116341d9c1f076d3f184b885a1f62882c0322e05bf40be42f975dc26ac44c4d163acc8117a0c412ebb38a59d54e16faaa9c9e8
7
- data.tar.gz: 013ef8fe9087f0f39a811f84aca8a66aead61046c8901d9859aff3057d4ff0c6b314f0ee362cbe6f715a802fc135b4e0831671a2adc1153e2eb796a62505adee
6
+ metadata.gz: bf73c0505ff7d7d6340a9af92732aed629b4dd02712d9dccada38a265695e5a879c3b9e1fe4e3df8ad63ba4a93fe6473fa7ccfd7cd6d2b2376ffc5140d382b17
7
+ data.tar.gz: 5fbeda3d3669a296f922fc03da14d2dcf429a845179696b70a4efb1e7275343bc6cdaef408462d9d90ed191f175efb9588b8ef07f33aa90283f8af4c31b4b0b0
@@ -1,11 +1,21 @@
1
1
  require 'active_record'
2
2
 
3
- if ActiveRecord::VERSION::MAJOR < 4
3
+ case ActiveRecord::VERSION::MAJOR
4
+ when 3
4
5
  ActiveRecord::Associations::Builder::HasMany.valid_options << :inherit
5
6
  ActiveRecord::Associations::Builder::HasOne.valid_options << :inherit
6
7
  ActiveRecord::Associations::Builder::BelongsTo.valid_options << :inherit
7
- else
8
+ when 4
8
9
  ActiveRecord::Associations::Builder::Association.valid_options << :inherit
10
+ when 5
11
+ # We can't add options into `valid_options` anymore.
12
+ # Here are the possible solutions:
13
+ # * monkey patch Assocition::VALID_OPTIONS
14
+ # * prepend the `valid_options` method
15
+ # * create an Extension class and add it via ActiveRecord::Associations::Builder::Association.extensions
16
+ #
17
+ # I went with the first one out of simplicity.
18
+ ActiveRecord::Associations::Builder::Association::VALID_OPTIONS << :inherit
9
19
  end
10
20
 
11
21
  module ActiveRecordInheritAssocPrepend
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_inherit_assoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Osheroff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2016-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 3.2.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.0'
22
+ version: '5.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 3.2.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.0'
32
+ version: '5.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: minitest
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  version: '0'
171
171
  requirements: []
172
172
  rubyforge_project:
173
- rubygems_version: 2.4.5
173
+ rubygems_version: 2.4.5.1
174
174
  signing_key:
175
175
  specification_version: 4
176
176
  summary: Attribute inheritance for AR associations