active_propagation 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_propagation.rb +10 -9
- data/lib/active_propagation/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7691ea2a07809154453b04b8974822f107c039e5
|
4
|
+
data.tar.gz: 8311711fe76d973b2a5cd3adc54dbceee192e813
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca8f8a998ee8bbba406fb055dc0b8ce3f34f0e7f7b486709b718e14c0e209864aa97c120955c6ee82ce7319a62d8a9f29ac85c9e3d6d449db28e4c918e8a140
|
7
|
+
data.tar.gz: 90489255c2342ab6e4854805c2a14d7269001e20724eb23c8bb179347cee12e556b2d791857deb84118a94f5f53ca43821db87d2f119478cfb719ac8632187a7
|
data/lib/active_propagation.rb
CHANGED
@@ -19,14 +19,6 @@ module ActivePropagation
|
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def assocs
|
23
|
-
assoc_klass.where(foreign_key => id)
|
24
|
-
end
|
25
|
-
|
26
|
-
def foreign_key
|
27
|
-
reflection.foreign_key
|
28
|
-
end
|
29
|
-
|
30
22
|
def assoc_klass
|
31
23
|
reflection.class_name.constantize
|
32
24
|
end
|
@@ -35,6 +27,14 @@ module ActivePropagation
|
|
35
27
|
klass.reflections.with_indifferent_access[association]
|
36
28
|
end
|
37
29
|
|
30
|
+
def model
|
31
|
+
klass.find(id)
|
32
|
+
end
|
33
|
+
|
34
|
+
def assocs
|
35
|
+
model.send(association)
|
36
|
+
end
|
37
|
+
|
38
38
|
attr_reader :klass, :association, :id
|
39
39
|
end
|
40
40
|
|
@@ -70,7 +70,8 @@ module ActivePropagation
|
|
70
70
|
def perform(klass_str, model_id, assoc_id, only, assoc_klass_str)
|
71
71
|
klass = klass_str.constantize
|
72
72
|
model = klass.find(model_id)
|
73
|
-
assoc_klass_str.constantize.find(assoc_id)
|
73
|
+
assoc_model = assoc_klass_str.constantize.find(assoc_id)
|
74
|
+
assoc_model.update(propagated_attributes(model, only))
|
74
75
|
end
|
75
76
|
end
|
76
77
|
|