store_model 4.6.0 → 4.6.1
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 +4 -4
- data/lib/store_model/model.rb +5 -2
- data/lib/store_model/types/one.rb +1 -1
- data/lib/store_model/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: c20c6465ee84ba2d0ffce4610ea14b6f6fed01e5da08cda8b165392e1d2e2952
|
|
4
|
+
data.tar.gz: 072ca921fd0b02814fc917b5d2c6b2df14f8c3bd99c536fda472b5df64ea7774
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a2e4339119a3076c4d200a535267033045d0fe75b461c2dfbe9b8d95bae1b4ecff0634ea5cbc5786076029fa2aba8027ac8a70e4f9d465c750f5f4d3a404b237
|
|
7
|
+
data.tar.gz: 1c8e8941a81e46a1f4d082a59252fc7867bcb95684a814a17701121e69ae82005fb0ca21da2dd3fea49467d3048c0c51ea0661c9d92b706573ce4a7e265c3eb5
|
data/lib/store_model/model.rb
CHANGED
|
@@ -294,10 +294,13 @@ module StoreModel
|
|
|
294
294
|
end
|
|
295
295
|
|
|
296
296
|
def serialized_attribute(attr)
|
|
297
|
-
|
|
297
|
+
case attr.value
|
|
298
|
+
when StoreModel::Model
|
|
298
299
|
Types::RawJSONEncoder.new(attr.value_for_database)
|
|
299
|
-
|
|
300
|
+
when Array
|
|
300
301
|
serialize_array_attribute(attr.value)
|
|
302
|
+
when Hash # attribute :smth, json
|
|
303
|
+
attr.value
|
|
301
304
|
else
|
|
302
305
|
attr.value_for_database
|
|
303
306
|
end
|
|
@@ -74,7 +74,7 @@ module StoreModel
|
|
|
74
74
|
case value
|
|
75
75
|
when String
|
|
76
76
|
payload = ActiveSupport::JSON.decode(value) rescue {}
|
|
77
|
-
model_instance(deserialize_by_types(payload))
|
|
77
|
+
model_instance(deserialize_by_types(payload)) unless payload.nil?
|
|
78
78
|
when ::Hash
|
|
79
79
|
model_instance(deserialize_by_types(value))
|
|
80
80
|
when nil
|
data/lib/store_model/version.rb
CHANGED