store_model 3.0.0 → 3.0.2

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
  SHA256:
3
- metadata.gz: 79f3b084f46c6eaf4add97a2c0cf23356524f4e5c08c8387535561231453cb4c
4
- data.tar.gz: 9471a0a8db98416257030134e1bebadb661a6bf8d2d1495c5232c09029884daf
3
+ metadata.gz: c7053cb5a3a84cc30ec1e8697c526bf433e13ac5974f65f580a4af39a50e9571
4
+ data.tar.gz: 44ee1c662c29687d960ebbc18b640700f6d2156f1f57c09d92522d646bc2d6cc
5
5
  SHA512:
6
- metadata.gz: 48c10f69a844c7adc77346b3cad3f27d15c53fd9281a7953213f7c7c92c0baad25b62c1a6f469fab7056ace9c7856688818d997d9a684b147935580d7e2972a5
7
- data.tar.gz: 60c00607715329c2e34bf101eba4c014a6cd29f564323d38bcd74921349996b441048c590d48c023eb6d2a4f254e1015526034bab7a10b5eb11a6524876284aa
6
+ metadata.gz: 2a052f5254c66d11c3c1465cb277271dbc4459065eea2e6a66e24cd127183c8592f00f36d96325b9c275bfbf7d65c801ecc14662d8422d19cf018b62aec02e75
7
+ data.tar.gz: d903a10321ddfcfe297ba2e2ab7c9659eccca30c016ffa1152ae95fa5dda1b52617d6834d46b46d9788ba8e0767c7c968d97dfbb5b5876d087395f9f5ed7c4e6
@@ -246,7 +246,7 @@ module StoreModel
246
246
  end
247
247
 
248
248
  def serialize_array_attribute(array)
249
- return array.as_json unless array.all? { |value| value.is_a?(StoreModel::Model) }
249
+ return array.as_json unless array.any? && array.all? { |value| value.is_a?(StoreModel::Model) }
250
250
 
251
251
  array.as_json(
252
252
  serialize_unknown_attributes: array.first.serialize_unknown_attributes?,
@@ -40,7 +40,7 @@ module StoreModel
40
40
  def serialize(value)
41
41
  case value
42
42
  when Array
43
- return ActiveSupport::JSON.encode(value) unless value.all? { |v| v.is_a?(StoreModel::Model) }
43
+ return ActiveSupport::JSON.encode(value) if value.empty? || value.any? { |v| !v.is_a?(StoreModel::Model) }
44
44
 
45
45
  ActiveSupport::JSON.encode(value,
46
46
  serialize_unknown_attributes: value.first.serialize_unknown_attributes?,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StoreModel # :nodoc:
4
- VERSION = "3.0.0"
4
+ VERSION = "3.0.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: store_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - DmitryTsepelev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-01 00:00:00.000000000 Z
11
+ date: 2024-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord