reactive-record 0.7.28 → 0.7.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a5269da6b54feb09d691d5852e4b236b689d662
4
- data.tar.gz: e6b947731add8eadc82e10b788d3880847665fb4
3
+ metadata.gz: c9ffa135c5fea49dd89fd26b3180299ff96fa2be
4
+ data.tar.gz: 759eb5f92565c62ce05f23c5be19955f914142f0
5
5
  SHA512:
6
- metadata.gz: 89102826cb196baffc99df77f910b6b5e620556c1ab7c2134fab12c46e05a0ee9b1ae564faddc51511f8674b136b1ad7b64235c709be7bda44b6ff41943aaf28
7
- data.tar.gz: 4d8f4b1cf33dbb4391b2e094732cfdec9f329e88fff3eae8b45bfdac2c9a1e0212872c05de9d54fbfa1dcb459b56af1fc1b692820decc52a14eb957bfff377a0
6
+ metadata.gz: dd724c0c0471ceea9c92d9c9a16f1c19f39a47ca40fe367f32c6eb504ef08141f45d69f48b52cfa9a0e99634e920cbddb87a776e75621870a7b9bcc7d4284a9c
7
+ data.tar.gz: 1a8b1bedcdafa10a6bfae116a1ace66e7f8eb7149dfc59e903b32753490cb4cd2814670404f372e60738a3a4b9b943baf767b21e02fe055322264c9ff2f990fd
@@ -64,7 +64,7 @@ module ActiveRecord
64
64
  def scope(name, body)
65
65
  singleton_class.send(:define_method, name) do | *args |
66
66
  args = (args.count == 0) ? name : [name, *args]
67
- ReactiveRecord::Base.class_scopes(self)[name] ||= ReactiveRecord::Collection.new(self, nil, nil, self, args)
67
+ ReactiveRecord::Base.class_scopes(self)[args] ||= ReactiveRecord::Collection.new(self, nil, nil, self, args)
68
68
  end
69
69
  singleton_class.send(:define_method, "#{name}=") do |collection|
70
70
  ReactiveRecord::Base.class_scopes(self)[name] = collection
@@ -274,7 +274,7 @@ module ReactiveRecord
274
274
  elsif aggregation
275
275
  new_value = aggregation.serialize(value)
276
276
  output_attributes[attribute] = new_value if record.changed?(attribute) or new_value != aggregation.serialize(record.synced_attributes[attribute])
277
- elsif record.changed?(attribute)
277
+ elsif record.new? or record.changed?(attribute)
278
278
  output_attributes[attribute] = value
279
279
  end
280
280
  end if record.new? || record.changed? || (record == record_being_saved && force)
@@ -416,7 +416,9 @@ module ReactiveRecord
416
416
  aggregation.mapping.each_with_index do |pair, i|
417
417
  record[pair.first] = value[i]
418
418
  end
419
- elsif key.to_s != "id"
419
+ elsif key.to_s != "id" and record.respond_to?("#{key}=") # server side methods can get included and we won't be able to write them...
420
+ # for example if you have a server side method foo, that you "get" on a new record, then later that value will get sent to the server
421
+ # we should track better these server side methods so this does not happen
420
422
  record.send("#{key}=",value)
421
423
  end
422
424
  end
@@ -1,3 +1,3 @@
1
1
  module ReactiveRecord
2
- VERSION = "0.7.28"
2
+ VERSION = "0.7.29"
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.28
4
+ version: 0.7.29
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-27 00:00:00.000000000 Z
11
+ date: 2015-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails