hyper-resource 1.0.0.lap75 → 1.0.0.lap76
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hyper_record/client_instance_methods.rb +12 -4
- data/lib/hyperloop/resource/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ce1175b9a38189b65f6808a5b74886a60c28810049245514277ba23fe2ccbde
|
4
|
+
data.tar.gz: c083a34eaa6f3219a295da8a635caf87e3434aa59c4be2ea744f67cc31e3a4f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96fcb7ba69e61b428eac56b5697763f5a8d9233d3ffce01ca19f4b8298bb6ac19fbdb24cccc577caeef7c3044b7a59ff3a0d7f8ac51751c60962405409adb506
|
7
|
+
data.tar.gz: 46d12e1710df25b38ea9dc7f203e6ae3ef3f006a6f945c5804ca2d0579e49dd2ec34cf56ab0d1b0b8d1b70545c42a81480306180471ddc266aae1daaa8494fee
|
@@ -148,15 +148,23 @@ module HyperRecord
|
|
148
148
|
relation_name = other_record.class.to_s.underscore.pluralize unless relation_name
|
149
149
|
if reflections.has_key?(relation_name)
|
150
150
|
if !called_from_collection && @fetch_states[relation_name] == 'f'
|
151
|
-
|
152
|
-
|
151
|
+
if %i[has_many has_and_belongs_to_many].include?(reflections[relation_name][:kind])
|
152
|
+
@relations[relation_name] = HyperRecord::Collection.new([], self, relation_name) if @relations[relation_name].nil?
|
153
|
+
@relations[relation_name].push(other_record)
|
154
|
+
else
|
155
|
+
@relations[relation_name] = other_record
|
156
|
+
end
|
153
157
|
end
|
154
158
|
else
|
155
159
|
relation_name = other_record.class.to_s.underscore
|
156
160
|
raise "No collection for record of type #{other_record.class}" unless reflections.has_key?(relation_name)
|
157
161
|
if !called_from_collection && @fetch_states[relation_name] == 'f'
|
158
|
-
|
159
|
-
|
162
|
+
if %i[has_many has_and_belongs_to_many].include?(reflections[relation_name][:kind])
|
163
|
+
@relations[relation_name] = HyperRecord::Collection.new([], self, relation_name) if @relations[relation_name].nil?
|
164
|
+
@relations[relation_name].push(other_record)
|
165
|
+
else
|
166
|
+
@relations[relation_name] = other_record
|
167
|
+
end
|
160
168
|
end
|
161
169
|
end
|
162
170
|
payload_hash = other_record.to_hash
|