active_record_inherit_assoc 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record_inherit_assoc.rb +8 -6
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b50165093b3e78ef2a8ab8efbf0d96e2b31dbe7e
|
4
|
+
data.tar.gz: a84150b1592e79cced4c06219ebc5c78e9c88266
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dc69e235c25fda1536c09d3c196891c4ae57ff8dce3eaf3a1f69f4785071f34f52704b6ffe2a626fa2e69d2090ab0793f418149d78c5f4e739aa6908aa2aeea
|
7
|
+
data.tar.gz: ccbe88f549fed65ccafbb003c34cfd53f190b0b4ec6228dcaa91813332e8f5bf420896147322996fd918379c70d458b29548ffbeb2c610ddd4626dc96243969e
|
@@ -8,17 +8,15 @@ else
|
|
8
8
|
ActiveRecord::Associations::Builder::Association.valid_options << :inherit
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
def
|
11
|
+
module ActiveRecordInheritAssocPrepend
|
12
|
+
def target_scope
|
13
13
|
if inherited_attributes = attribute_inheritance_hash
|
14
|
-
|
14
|
+
super.where(inherited_attributes)
|
15
15
|
else
|
16
|
-
|
16
|
+
super
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
alias_method_chain :association_scope, :value_inheritance
|
21
|
-
|
22
20
|
private
|
23
21
|
|
24
22
|
def attribute_inheritance_hash
|
@@ -27,6 +25,10 @@ ActiveRecord::Associations::Association.class_eval do
|
|
27
25
|
end
|
28
26
|
end
|
29
27
|
|
28
|
+
ActiveRecord::Associations::Association.class_eval do
|
29
|
+
prepend ActiveRecordInheritAssocPrepend
|
30
|
+
end
|
31
|
+
|
30
32
|
class ActiveRecord::Base
|
31
33
|
# Makes the model inherit the specified attribute from a named association.
|
32
34
|
#
|
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.
|
4
|
+
version: 2.2.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-
|
11
|
+
date: 2015-08-07 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: '
|
22
|
+
version: '5.0'
|
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: '
|
32
|
+
version: '5.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: minitest
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,6 +128,20 @@ dependencies:
|
|
128
128
|
- - ">="
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: byebug
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
type: :development
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
131
145
|
description:
|
132
146
|
email:
|
133
147
|
- ben@gimbo.net
|