reactive-record 0.7.27 → 0.7.28
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a5269da6b54feb09d691d5852e4b236b689d662
|
4
|
+
data.tar.gz: e6b947731add8eadc82e10b788d3880847665fb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89102826cb196baffc99df77f910b6b5e620556c1ab7c2134fab12c46e05a0ee9b1ae564faddc51511f8674b136b1ad7b64235c709be7bda44b6ff41943aaf28
|
7
|
+
data.tar.gz: 4d8f4b1cf33dbb4391b2e094732cfdec9f329e88fff3eae8b45bfdac2c9a1e0212872c05de9d54fbfa1dcb459b56af1fc1b692820decc52a14eb957bfff377a0
|
@@ -35,6 +35,7 @@ module ReactiveRecord
|
|
35
35
|
attr_accessor :destroyed
|
36
36
|
attr_accessor :updated_during
|
37
37
|
attr_accessor :synced_attributes
|
38
|
+
attr_accessor :virgin
|
38
39
|
|
39
40
|
# While data is being loaded from the server certain internal behaviors need to change
|
40
41
|
# for example records all record changes are synced as they happen.
|
@@ -86,7 +87,6 @@ module ReactiveRecord
|
|
86
87
|
# and set the primary if we have one
|
87
88
|
record.sync_attribute(model.primary_key, id) if id
|
88
89
|
end
|
89
|
-
|
90
90
|
# finally initialize and return the ar_instance
|
91
91
|
record.ar_instance ||= infer_type_from_hash(model, record.attributes).new(record)
|
92
92
|
end
|
@@ -214,6 +214,7 @@ module ReactiveRecord
|
|
214
214
|
end
|
215
215
|
|
216
216
|
aggregate_record = attributes[attribute].backing_record
|
217
|
+
aggregate_record.virgin = false
|
217
218
|
|
218
219
|
if value
|
219
220
|
value_attributes = value.backing_record.attributes
|
@@ -475,7 +475,8 @@ module ReactiveRecord
|
|
475
475
|
|
476
476
|
saved_models = reactive_records.collect do |reactive_record_id, model|
|
477
477
|
puts "saving rr_id: #{reactive_record_id} model.object_id: #{model.object_id} frozen? <#{model.frozen?}>"
|
478
|
-
if model and (model.frozen? or dont_save_list.include?(model))
|
478
|
+
if model and (model.frozen? or dont_save_list.include?(model) or model.changed.include?(model.class.primary_key))
|
479
|
+
# the above check for changed including the private key happens if you have an aggregate that includes its own id
|
479
480
|
puts "validating frozen model #{model.class.name} #{model} (reactive_record_id = #{reactive_record_id})"
|
480
481
|
valid = model.valid?
|
481
482
|
puts "has_errors before = #{has_errors}, validate= #{validate}, !valid= #{!valid} (validate and !valid) #{validate and !valid}"
|
@@ -187,9 +187,11 @@ module ReactiveRecord
|
|
187
187
|
self
|
188
188
|
end
|
189
189
|
rescue Exception => e
|
190
|
-
|
191
|
-
|
192
|
-
|
190
|
+
if cache_item.value and cache_item.value != []
|
191
|
+
raise "ReactiveRecord exception caught when applying #{method} to db object #{cache_item.value}: #{e}"
|
192
|
+
else
|
193
|
+
representative
|
194
|
+
end
|
193
195
|
end
|
194
196
|
else
|
195
197
|
representative
|
@@ -314,8 +316,8 @@ module ReactiveRecord
|
|
314
316
|
target.send "#{method}=", aggregation.deserialize(value.first)
|
315
317
|
elsif value.is_a? Array
|
316
318
|
target.send "#{method}=", value.first unless method == "id" # we handle ids first so things sync nicely
|
317
|
-
elsif value.is_a? Hash and value[:id] and value[:id].first
|
318
|
-
association
|
319
|
+
elsif value.is_a? Hash and value[:id] and value[:id].first and association = target.class.reflect_on_association(method)
|
320
|
+
# not sure if its necessary to check the id above... is it possible to for the method to be an association but not have an id?
|
319
321
|
new_target = association.klass.find(value[:id].first)
|
320
322
|
target.send "#{method}=", new_target
|
321
323
|
elsif !(target.class < ActiveRecord::Base)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reactive-record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mitch VanDuyn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|