active_propagation 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa77bf7810c2c6fdb0f3b1d991c02fa363a91508
4
- data.tar.gz: 9e6e48a4a4dec9624d7876adc8af0928231cb69f
3
+ metadata.gz: 7691ea2a07809154453b04b8974822f107c039e5
4
+ data.tar.gz: 8311711fe76d973b2a5cd3adc54dbceee192e813
5
5
  SHA512:
6
- metadata.gz: 0fef0dadab35fbd04d75232990c64833ee21785eadc364a5784a89e83414831b525b1d2b834c736d411d04c9d5f9d4606c57c376923fa170bcd67a547e7d9609
7
- data.tar.gz: 74aff79c936a503eea3185da6078eaceb63a1633ad500724e3854ef092dc1e1640c85a3e4df161ddb9f0a091e1896e2678d877b2b136f2b45899f93636f29e5b
6
+ metadata.gz: 3ca8f8a998ee8bbba406fb055dc0b8ce3f34f0e7f7b486709b718e14c0e209864aa97c120955c6ee82ce7319a62d8a9f29ac85c9e3d6d449db28e4c918e8a140
7
+ data.tar.gz: 90489255c2342ab6e4854805c2a14d7269001e20724eb23c8bb179347cee12e556b2d791857deb84118a94f5f53ca43821db87d2f119478cfb719ac8632187a7
@@ -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).update(propagated_attributes(model, only))
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
 
@@ -1,3 +1,3 @@
1
1
  module ActivePropagation
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_propagation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoshiki Schmitz