acts_as_elibri_product 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/acts_as_elibri_product/version.rb +1 -1
- data/lib/acts_as_elibri_product.rb +13 -4
- metadata +4 -4
@@ -77,10 +77,19 @@ module ActsAsElibriProduct
|
|
77
77
|
write_attribute(traverse_vector[change], product_updated.send(change))
|
78
78
|
elsif change.is_a?(Hash) && traverse_vector[change.keys.first]
|
79
79
|
change.values.first.each do |elibri_attrib|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
if elibri_attrib.is_a? Hash
|
81
|
+
elibri_attrib.each_pair do |k,v|
|
82
|
+
db_attrib = traverse_vector[change.keys.first].values.first[v]
|
83
|
+
object = self.send(traverse_vector[change.keys.first].keys.first).find { |x| x.import_id == k }
|
84
|
+
elibri_object = product_updated.send(change.keys.first).find { |x| x.id == k }
|
85
|
+
object.send(:write_attribute, db_attrib, elibri_object.send(v))
|
86
|
+
end
|
87
|
+
else
|
88
|
+
db_attrib = traverse_vector[change.keys.first].values.first[elibri_attrib]
|
89
|
+
object = self.send(traverse_vector[change.keys.first].keys.first)
|
90
|
+
elibri_object = product_updated.send(change.keys.first)
|
91
|
+
object.send(:write_attribute, db_attrib, elibri_object.send(elibri_attrib))
|
92
|
+
end
|
84
93
|
end
|
85
94
|
# read_attribute(traverse_vector[change.keys.first]).send("#{traverse_vector[change[keys.first]]}=", product_updated.send(change.keys.first).send(change[keys.first]))
|
86
95
|
else
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_elibri_product
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Piotr Szmielew
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-05-
|
18
|
+
date: 2012-05-07 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rails
|