deco_lite 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/deco_lite/hash_loadable.rb +2 -4
- data/lib/deco_lite/model.rb +2 -2
- data/lib/deco_lite/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5e504d4b1c9442022ff1d9dc1727f1116b3be5bef76cce7c3f0b4373e1d5531
|
4
|
+
data.tar.gz: c92ec939a0264e410d01d847521ecbd6432fd67e949858c8cc5183354e4aabd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2e87a67fce2ce3177231eb78ba340bef28b415a67263098ec7c9ee1a99e8b9e670bcbf04f9393c9db98e4f3186c5e34eb90e9db5140ecb88df5de9088304d3f
|
7
|
+
data.tar.gz: cc3c507551e330c3b6fe052384106a0deed623a3d842ade9f0d119ee5f0886def3cce4de96737dbeec246c816941e5d62c19f7f62c6260900403d2fac9a15d11
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
### 1.2.1
|
2
|
+
* Bugs
|
3
|
+
* Fix bug that did not recognize loaded field values if `attr_accessors` were previously created for the loaded fields due to model validations being present. If `ActiveModel` validators are present on the model, DecoLite will automatically create `attr_accessors` for the fields associated with the validations. The presence of these fields being automatically loaded prohibited any fields subsequently loaded having the same field names to not be recognized as having been loaded, causing validation to validate incorrectly (the model did not recognize the fields as having been loaded).
|
4
|
+
* Fix bug that wiped out field values previously loaded if `ActiveModel` validations were present for fields having the same name. This is because DecoLite will automatically create `attr_accessors` for the fields associated with the validations, initializing these automatically created field vars to be initialized to nil. The auto-creation of these `attr_accessors` was taking place in #initialize AFTER the initial load of any Hash passed to #initialize in the :hash param, so the values loaded were getting nilled out.
|
5
|
+
* Changes
|
6
|
+
* Add specs to test the above scenarios.
|
7
|
+
|
1
8
|
### 1.2.0
|
2
9
|
* Changes
|
3
10
|
* Update the README.md file with better explainations and examples.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# DecoLite
|
2
2
|
|
3
|
-
[![GitHub version](http://badge.fury.io/gh/gangelo%
|
3
|
+
[![GitHub version](http://badge.fury.io/gh/gangelo%2Fdeco_lite.svg)](https://badge.fury.io/gh/gangelo%2Fdeco_lite)
|
4
4
|
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/deco_lite.svg)](https://badge.fury.io/rb/deco_lite)
|
6
6
|
|
@@ -136,7 +136,7 @@ wife = {
|
|
136
136
|
},
|
137
137
|
}
|
138
138
|
|
139
|
-
class Couple < DecoLite::Model
|
139
|
+
class Couple < DecoLite::Model
|
140
140
|
def live_together?
|
141
141
|
husband_info_address == wife_info_address
|
142
142
|
end
|
@@ -21,10 +21,8 @@ module DecoLite
|
|
21
21
|
load_service.execute(hash: hash, options: load_service_options).tap do |service_hash|
|
22
22
|
service_hash.each_pair do |field_name, value|
|
23
23
|
create_field_accessor field_name: field_name, options: deco_lite_options
|
24
|
-
|
25
|
-
|
26
|
-
field_names << field_name
|
27
|
-
end
|
24
|
+
yield field_name if block_given?
|
25
|
+
field_names << field_name unless field_names.include? field_name
|
28
26
|
set_field_value(field_name: field_name, value: value, options: deco_lite_options)
|
29
27
|
end
|
30
28
|
end
|
data/lib/deco_lite/model.rb
CHANGED
@@ -34,9 +34,9 @@ module DecoLite
|
|
34
34
|
|
35
35
|
hash ||= {}
|
36
36
|
|
37
|
-
load_hash!(hash: hash, options: options) if hash.present?
|
38
|
-
|
39
37
|
load_hash!(hash: auto_attr_accessors, options: options, add_loaded_fields: false) if auto_attr_accessors?
|
38
|
+
|
39
|
+
load_hash!(hash: hash, options: options) if hash.present?
|
40
40
|
end
|
41
41
|
|
42
42
|
validate :validate_required_fields
|
data/lib/deco_lite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deco_lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gene M. Angelo, Jr.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|