activerecord-typedstore 1.3.2 → 1.4.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17f01f8701f6af429d7fb15bfbcf9cf202f1d82cbe0f6878aa4a503ed69fc0e8
|
4
|
+
data.tar.gz: e5e1dd4100a034b074fe2682e485ae1365c8bcbe9c4bb7bc96f697a5042c0f62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1703f9023ab91ac749d74335276a0824d3072060eac8a68270f2b52e41198dfeebecffd54738cd4b097fe97948371479e2db1c1fa8ebc30ca07eeeaf63bac91
|
7
|
+
data.tar.gz: 8e48b1f137a374053092ccf52f3411759fcf421d1e4d8cf8b7f47b3c25d935aaf958f568ee35423381171aca879bf68a7b943493cf4947a8d3af19f66d54616f
|
@@ -23,8 +23,8 @@ module ActiveRecord::TypedStore
|
|
23
23
|
define_method(method) do |value|
|
24
24
|
return if value.nil?
|
25
25
|
|
26
|
-
if value.respond_to?(:
|
27
|
-
super(value.
|
26
|
+
if value.respond_to?(:to_hash)
|
27
|
+
super(value.to_hash)
|
28
28
|
else
|
29
29
|
raise ArgumentError, "ActiveRecord::TypedStore expects a hash as a column value, #{value.class} received"
|
30
30
|
end
|
@@ -723,6 +723,11 @@ shared_examples 'a store' do |retain_type = true, settings_type = :text|
|
|
723
723
|
expect(model.explicit_settings[:signup][:counter]).to be_nil
|
724
724
|
end
|
725
725
|
|
726
|
+
it 'coerce hashes to HashWithIndifferentAccess' do # this is actually Rails behavior
|
727
|
+
model.signup[:metadata] = { "signed_up_at" => Time.now }
|
728
|
+
expect(model.signup[:metadata]).to be_a ActiveSupport::HashWithIndifferentAccess
|
729
|
+
end
|
730
|
+
|
726
731
|
end
|
727
732
|
end
|
728
733
|
|
@@ -841,6 +846,11 @@ describe YamlTypedStoreModel do
|
|
841
846
|
it_should_behave_like 'any model'
|
842
847
|
it_should_behave_like 'a store'
|
843
848
|
it_should_behave_like 'a model supporting arrays'
|
849
|
+
|
850
|
+
it 'nested hashes are not serialized as HashWithIndifferentAccess' do
|
851
|
+
model = described_class.create!
|
852
|
+
expect(model.settings_before_type_cast).not_to include('HashWithIndifferentAccess')
|
853
|
+
end
|
844
854
|
end
|
845
855
|
|
846
856
|
describe JsonTypedStoreModel do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-typedstore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
rubygems_version: 3.1.
|
193
|
+
rubygems_version: 3.1.2
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: Add type casting and full method attributes support to АctiveRecord store
|