reactive-record 0.7.7 → 0.7.8

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: e925fd65899df1cb77f96d9f3ccd69ec217c84b0
4
- data.tar.gz: 758b5f711b45aa013975580fb6e35efe0e84d1b5
3
+ metadata.gz: 5cf9494b1346a998d25e757a2753208692fde69b
4
+ data.tar.gz: 46ab8888020d0076cd9f53fea513519f8eba9910
5
5
  SHA512:
6
- metadata.gz: 0488d3001210b59a6e041807c4766b9110986b9f66e6327eb06214252d874d5b8c6873e96897c92c8f7c7c0a24a1dacc56f64d947a09f883eaae4a338e2d1494
7
- data.tar.gz: 6a37ddf21f528087ee68fea326eead883c740b7b61697106593a2089a58783173b9d8e0ecdfd263cce86d4987a9b6f7a76800afe9fa35857244b249a062c1d20
6
+ metadata.gz: 0910cbdc2a1a2fb315b0ebcc055d6f6be39ad8091ffb428f72e5898417f81a0a8e14fbaf83c49e39e9d6dc6dafc1c46fd4e6f22495ff9dbd1ab1fa26f642a495
7
+ data.tar.gz: 0361491939e7ae8af1a226f4e59db7f6345a16f9237be03b5cda683919b1a0657c338600649d5891a0c3108236e33de29a505e283e8d09e838018c0a41a772f6
@@ -178,20 +178,25 @@ module ReactiveRecord
178
178
  end
179
179
  end
180
180
  end
181
+ was_changed = changed2(@attributes.dup)
181
182
  attributes[attribute] = value
182
183
  React::State.set_state(self, attribute, value) unless data_loading?
184
+ React::State.set_state(self, self, :changed) unless data_loading? or (was_changed == changed2({attribute => value}))
183
185
  end
184
186
  value
185
187
  end
186
-
188
+
187
189
  def changed?(*args)
188
- attrs = if args.count == 0
190
+ changed2(if args.count == 0
189
191
  React::State.get_state(self, self)
190
192
  @attributes.dup
191
193
  else
192
194
  React::State.get_state(@attributes, args[0])
193
195
  {args[0] => @attributes[args[0]]}
194
- end
196
+ end)
197
+ end
198
+
199
+ def changed2(attrs)
195
200
  attrs.each do |attribute, value|
196
201
  if association = @model.reflect_on_association(attribute) and association.collection? and value
197
202
  return true unless value == @synced_attributes[attribute]
@@ -1,3 +1,3 @@
1
1
  module ReactiveRecord
2
- VERSION = "0.7.7"
2
+ VERSION = "0.7.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactive-record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.7
4
+ version: 0.7.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mitch VanDuyn