hstore_accessor 0.3.0 → 0.3.1

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: ed6227f16f31ca2c856584b8e72ae0fb9065f659
4
- data.tar.gz: f08a8c2cdf12a47e7ed620289fdbf9fa1677e46b
3
+ metadata.gz: 2a5d9f17253e89a2b07c07a55c190d7c2a04b8ae
4
+ data.tar.gz: d285866bb3f67915215e7266d3de5d3f5a65a35d
5
5
  SHA512:
6
- metadata.gz: 9617209ac08dd3fbc9a48fdd56866396bb3098e127f66e51c9182f09f565f21f2e9cd084917c9e31f3b60c0e99aec11b312f70d1213df4e80f995d41479267db
7
- data.tar.gz: fd258525d2f42d3fc42604d000b1302938459d5ad3d65c5d994c11a3209932b0c9181a4058c4144bcbb54c14fcdd3d45aeadd9431655ad3d6a4cf94b4f020819
6
+ metadata.gz: cf306876687e4430a522deb04adf10ccf166c4a3d6362e0daf0bdc119cd07345c265646e1f33131bd690f5b34292f1cb6908f51e94a7b15bf5cbcd1153fc5663
7
+ data.tar.gz: 7717387fe1db69737e6fc73c5cdb2d6967876ac027f5bc840b970ea846e1737b40d1e943b5d1e6aaea965e8652d000fb99ddd8fdaa32c80c8b0f905444e8acf3
@@ -22,7 +22,7 @@ module HstoreAccessor
22
22
 
23
23
  DESERIALIZERS = {
24
24
  :array => -> value { (value && value.split(SEPARATOR)) || [] },
25
- :hash => -> value { JSON.parse(value) },
25
+ :hash => -> value { (value && JSON.parse(value)) || {} },
26
26
  :integer => -> value { value.to_i },
27
27
  :float => -> value { value.to_f },
28
28
  :time => -> value { Time.at(value.to_i) },
@@ -1,3 +1,3 @@
1
1
  module HstoreAccessor
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -180,6 +180,7 @@ describe HstoreAccessor do
180
180
  end
181
181
 
182
182
  it "returns an empty array if an array value is not set" do
183
+ expect(Product.new.tags).to eq []
183
184
  product.tags = nil
184
185
  product.save
185
186
  product.reload
@@ -194,6 +195,7 @@ describe HstoreAccessor do
194
195
  end
195
196
 
196
197
  it "returns an empty hash if a hash value is not set" do
198
+ expect(Product.new.reviews).to eq({})
197
199
  product.reviews = nil
198
200
  product.save
199
201
  product.reload
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hstore_accessor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Hirn