reactive-record 0.7.12 → 0.7.13
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50274de5e97355af971444c44fc6e11c7d6cc5bf
|
4
|
+
data.tar.gz: 6826664275c50d1c5c9ac06ff2e9ae624b0f8be5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24ca2f3773a7c226c3132f1aaff9d868b3bf91705b202b14681f2f157da5a66654542151419067f1c97c0a8943a8adbad43b9ecfdb73d678dbfe90198e49c181
|
7
|
+
data.tar.gz: 59a9ca009c337aa4ec5e51252a317b3857593d5359759df24bafec1c1d92347497c593a440d0c6b6aa58370021c60a977d0b63357a05dcb9d0641baa51e79aa1
|
@@ -110,7 +110,11 @@ module ActiveRecord
|
|
110
110
|
klass = ReactiveRecord::Base.infer_type_from_hash(self, param)
|
111
111
|
klass == self or klass < self
|
112
112
|
else
|
113
|
-
|
113
|
+
if param[primary_key]
|
114
|
+
target = find(param[primary_key])
|
115
|
+
else
|
116
|
+
target = new
|
117
|
+
end
|
114
118
|
ReactiveRecord::Base.load_from_json(Hash[param.collect { |key, value| [key, [value]] }], target)
|
115
119
|
target
|
116
120
|
end
|
@@ -78,6 +78,7 @@ module ReactiveRecord
|
|
78
78
|
# rendering cycle completes.
|
79
79
|
# takes care of informing react that there are things to load, and schedules the loader to run
|
80
80
|
# Note there is no equivilent to find_in_db, because each vector implicitly does a find.
|
81
|
+
raise "attempt to do a find_by_id of nil. This will return all records, and is not allowed" if vector[1] == ["find_by_id", nil]
|
81
82
|
unless data_loading?
|
82
83
|
@pending_fetches << vector
|
83
84
|
schedule_fetch
|
@@ -251,8 +251,9 @@ module ReactiveRecord
|
|
251
251
|
new_target = target.send *method unless value.is_a? Array # value is an array if scope returns nil
|
252
252
|
elsif value.is_a? Array
|
253
253
|
target.send "#{method}=", value.first
|
254
|
-
elsif value.is_a? Hash and value[:id] and value[:id].first
|
255
|
-
|
254
|
+
elsif value.is_a? Hash and value[:id] and value[:id].first #and
|
255
|
+
association = target.class.reflect_on_association(method)
|
256
|
+
new_target = association.klass.find(value[:id].first)
|
256
257
|
target.send "#{method}=", new_target
|
257
258
|
else
|
258
259
|
new_target = target.send("#{method}=", target.send(method))
|
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.13
|
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-09-
|
11
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|