store_model 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
  SHA256:
3
- metadata.gz: 917f6d81bda1120cd7801117957d7ccd65e16214816dcac19176852abd54a46a
4
- data.tar.gz: 682125c5da079cc5f9b996020d301a89c2c066206c202d88e790c04cf43b22c4
3
+ metadata.gz: ea446173092e4c6df74a466d2033931a75fe1872b4c52c56ff28563e777dfa6c
4
+ data.tar.gz: 7eb5bb8bd19def8aa41e6f4f1c4fc720f9724903742e3902acb8163fa5cdb500
5
5
  SHA512:
6
- metadata.gz: 61dfaf89ef4bb1f712d8e7ae1210d52d97de8d684e98555ab4a51bb93d2a2e28a7634d160bf3dbc3b902f72a4ada384441b838fc14cff107efe0030f2a4c1bd9
7
- data.tar.gz: 23f0572124d1749cadef51db9a992179c427d9e4e7adec3547305efd35ba6a47fe06bb613a758fcd956570a49f830e387301f373e961a92ea9d05d2fc92b7f26
6
+ metadata.gz: 62ba626e10a6479408b8a503aaae94ea9ecf590b824719e7a19c7f108b886f0c24e455bc22ac88a24ba133d1d403618e2ad2e98964832185dc6cb04afa1a7b61
7
+ data.tar.gz: 2c92ebc0c68bd1584b6dabfbebfe83de6f0acccc682f01ce814ad129129c017678b6962043c25b490dae249251172abb871d9f69ec5d8ed57e01f102c3c65666
data/README.md CHANGED
@@ -82,6 +82,8 @@ end
82
82
 
83
83
  After that, your attribute will return array of `Configuration` instances.
84
84
 
85
+ > Heads up! Attribute is not the same as association, in this case - it's just a hash. `assign_attributes` (and similar) is going to _override_ the whole hash, not merge it with a previous value
86
+
85
87
  ## Validations
86
88
 
87
89
  `StoreModel` supports all the validations shipped with `ActiveModel`. Start with defining validation for the store model:
@@ -17,6 +17,7 @@ module StoreModel
17
17
  case value
18
18
  when String then decode_and_initialize(value)
19
19
  when Array then ensure_model_class(value)
20
+ when nil then value
20
21
  else
21
22
  raise StoreModel::Types::CastError,
22
23
  "failed casting #{value.inspect}, only String or Array instances are allowed"
@@ -17,7 +17,7 @@ module StoreModel
17
17
  case value
18
18
  when String then decode_and_initialize(value)
19
19
  when Hash then @model_klass.new(value)
20
- when @model_klass then value
20
+ when @model_klass, nil then value
21
21
  else
22
22
  raise StoreModel::Types::CastError,
23
23
  "failed casting #{value.inspect}, only String, " \
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StoreModel
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
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: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DmitryTsepelev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-06 00:00:00.000000000 Z
11
+ date: 2019-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails