activeentity 0.0.1.beta6 → 0.0.1.beta7
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e1c2c1130f1a4dc9deb8425b542a4db50aeea8e50d365d5b3d42ef6bf11b8d0
|
4
|
+
data.tar.gz: 5e8d4e28096dfcc3b0e0589e2c05e56866a1ad7a45f328728cc9ecde81478a37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd64ddbf122a6f74b5c4ce60ed0e3dc37356133149ebdef59fc9931f42a4e94361acaa4bc6349ac28f2f3f66d55e0d297580d562559b4c92909521abd66db79a
|
7
|
+
data.tar.gz: 2ec470ad55e02d72c9d81a4e914b092cf73377347891d761f172cc28c1605bdf8263f984a4800cdeeb6282c86094301705805f88ec0482523e879a5406ef05b7
|
@@ -124,9 +124,20 @@ module ActiveEntity
|
|
124
124
|
# Replace this collection with +other_array+. This will perform a diff
|
125
125
|
# and delete/add only records that have changed.
|
126
126
|
def replace(other_array)
|
127
|
-
other_array.
|
127
|
+
records = other_array.map do |val|
|
128
|
+
if val.is_a? reflection.klass
|
129
|
+
val
|
130
|
+
elsif val.nil?
|
131
|
+
next
|
132
|
+
elsif val.respond_to?(:to_h)
|
133
|
+
build_record(val.to_h)
|
134
|
+
end
|
135
|
+
rescue => ex
|
136
|
+
raise_on_type_mismatch!(val)
|
137
|
+
raise ex
|
138
|
+
end
|
128
139
|
|
129
|
-
target.replace
|
140
|
+
target.replace records
|
130
141
|
end
|
131
142
|
|
132
143
|
def include?(record)
|