reactive-record 0.7.32 → 0.7.33

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: 280e751548b64eb27ab554fc761593cf55dbcf66
4
- data.tar.gz: e066f2f6ccd9170f38b4b7c69d83a178dbf20113
3
+ metadata.gz: 6f071187fbe9b4f2c5a5ae000a389e429986e34d
4
+ data.tar.gz: 5c35aad8d66556df49791a83d05f0569e05adb98
5
5
  SHA512:
6
- metadata.gz: 70e341c82153a5ace4a28ed200d6ab6b1c3cc153c8607de3ec4b2a8c2a718f99ecfeb5e1c1ec1fd2c493f4c4dca9afc699f1950c65c5001a17aea097f2d4bdff
7
- data.tar.gz: 331576cc4d382ad6cf40ff1fb77705c2548c4af48007cfba2e644d60a4c83b79f997ff0cc44d8bfc5691278f8c6ba03521665125c0ac7391905949218c5eedc8
6
+ metadata.gz: bc6431f25bf37975dcf2f294e0cb0feb202730cca3742bff0dda4507058308e5fb48d6f0c677f445f0af58734983fcff093a230145d6db7bfca877e93d411b83
7
+ data.tar.gz: b194befb441790f8305e4c8909f7eaacb631978d8629a86691c8e0fb3e22085ee3b6230ef991059710fdd61e294dd416b222b893d7b9b9d4197b8a6468ed974c
@@ -234,7 +234,7 @@ module ReactiveRecord
234
234
  def update_attribute(attribute, *args)
235
235
  value = args[0]
236
236
  if args.count != 0 and data_loading?
237
- if aggregation = model.reflect_on_aggregation(attribute) and !(aggregation.klass < ActiveRecord::Base)
237
+ if (aggregation = model.reflect_on_aggregation(attribute)) and !(aggregation.klass < ActiveRecord::Base)
238
238
  @synced_attributes[attribute] = aggregation.deserialize(aggregation.serialize(value))
239
239
  else
240
240
  @synced_attributes[attribute] = value
@@ -245,12 +245,12 @@ module ReactiveRecord
245
245
  return
246
246
  end
247
247
  changed = if args.count == 0
248
- if association = @model.reflect_on_association(attribute) and association.collection?
248
+ if (association = @model.reflect_on_association(attribute)) and association.collection?
249
249
  attributes[attribute] != @synced_attributes[attribute]
250
250
  else
251
251
  !attributes[attribute].backing_record.changed_attributes.empty?
252
252
  end
253
- elsif association = @model.reflect_on_association(attribute) and association.collection?
253
+ elsif (association = @model.reflect_on_association(attribute)) and association.collection?
254
254
  value != @synced_attributes[attribute]
255
255
  else
256
256
  !@synced_attributes.has_key?(attribute) or @synced_attributes[attribute] != value
@@ -324,10 +324,10 @@ module ReactiveRecord
324
324
  end
325
325
 
326
326
  def revert
327
- @attributes.each do |attribute, value|
327
+ @changed_attributes.each do |attribute|
328
328
  @ar_instance.send("#{attribute}=", @synced_attributes[attribute])
329
+ @attributes.delete(attribute) unless @synced_attributes.has_key?(attribute)
329
330
  end
330
- @attributes.delete_if { |attribute, value| !@synced_attributes.has_key?(attribute) }
331
331
  @changed_attributes = []
332
332
  @errors = nil
333
333
  end
@@ -93,6 +93,7 @@ module ReactiveRecord
93
93
  all << item unless all.include? item # does this use == if so we are okay...
94
94
  if backing_record and @owner and @association and inverse_of = @association.inverse_of and item.attributes[inverse_of] != @owner
95
95
  current_association = item.attributes[inverse_of]
96
+ backing_record.virgin = false unless backing_record.data_loading?
96
97
  backing_record.update_attribute(inverse_of, @owner)
97
98
  current_association.attributes[@association.attribute].delete(item) if current_association and current_association.attributes[@association.attribute]
98
99
  @owner.backing_record.update_attribute(@association.attribute) # forces a check if association contents have changed from synced values
@@ -1,3 +1,3 @@
1
1
  module ReactiveRecord
2
- VERSION = "0.7.32"
2
+ VERSION = "0.7.33"
3
3
  end
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.32
4
+ version: 0.7.33
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-12-29 00:00:00.000000000 Z
11
+ date: 2015-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails