ph_model 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +1 -0
- data/lib/ph_model.rb +1 -1
- data/lib/ph_model/concerns/attribute_nested_validation.rb +5 -1
- data/lib/ph_model/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a8bb10b5076969dde5de65f82075a828c82009f0
|
|
4
|
+
data.tar.gz: b5d265dbda5b2ccb53007fbf95396bb2bb34198d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0fd9bd0332175ab8b64654a3cf1c849cdc2a6451ea7f8956a2092ab0e03d82bef7880829627aef51321f8ba9d3b3958e2f037d4e01d4908c1095ea5808ed5b08
|
|
7
|
+
data.tar.gz: 5cfb58ad27a2c08b5ae85524f7553a05d1758fb16dbb660eab693b9b4a829e582d0fc144073cdd24e1eaa53452a95d69d70cb4cf35b88e2d25b507825cbe4150
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [v1.1.0](https://github.com/payrollhero/ph_model/tree/v1.1.0) (2017-05-23)
|
|
4
|
+
[Full Changelog](https://github.com/payrollhero/ph_model/compare/v1.0.2...v1.1.0)
|
|
5
|
+
|
|
6
|
+
## [v1.0.2](https://github.com/payrollhero/ph_model/tree/v1.0.2) (2017-04-06)
|
|
7
|
+
[Full Changelog](https://github.com/payrollhero/ph_model/compare/v1.0.1...v1.0.2)
|
|
8
|
+
|
|
9
|
+
## [v1.0.1](https://github.com/payrollhero/ph_model/tree/v1.0.1) (2017-04-04)
|
|
10
|
+
[Full Changelog](https://github.com/payrollhero/ph_model/compare/v1.0.0...v1.0.1)
|
|
11
|
+
|
|
3
12
|
## [v1.0.0](https://github.com/payrollhero/ph_model/tree/v1.0.0) (2017-04-04)
|
|
4
13
|
[Full Changelog](https://github.com/payrollhero/ph_model/compare/v0.0.1...v1.0.0)
|
|
5
14
|
|
data/README.md
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
[](https://codeclimate.com/github/payrollhero/ph_model)
|
|
12
12
|
[](https://codeclimate.com/github/payrollhero/ph_model)
|
|
13
13
|
[](https://gemnasium.com/payrollhero/ph_model)
|
|
14
|
+
[](https://badge.fury.io/rb/ph_model)
|
|
14
15
|
|
|
15
16
|
This Gem basically marries ActiveModel and ActiveAttr is a nice package.
|
|
16
17
|
|
data/lib/ph_model.rb
CHANGED
|
@@ -31,7 +31,7 @@ module PhModel
|
|
|
31
31
|
include Concerns::AttributeNestedValidation
|
|
32
32
|
include Concerns::AttributeOfArrayTypeInitialization
|
|
33
33
|
|
|
34
|
-
def as_json
|
|
34
|
+
def as_json(*)
|
|
35
35
|
{}.tap do |hash|
|
|
36
36
|
self.class.attributes.each do |attribute_name, _info|
|
|
37
37
|
hash[attribute_name] = send(attribute_name).as_json
|
|
@@ -13,7 +13,7 @@ module PhModel
|
|
|
13
13
|
if info[:type].is_a? Array
|
|
14
14
|
if value.respond_to? :each_with_index
|
|
15
15
|
value.each_with_index do |item_value, index|
|
|
16
|
-
check_one(item_value,
|
|
16
|
+
check_one(item_value, format_nested_attribute_name(attribute_name, index, item_value))
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
else
|
|
@@ -22,6 +22,10 @@ module PhModel
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def format_nested_attribute_name(attribute_name, index, item_value)
|
|
26
|
+
"#{attribute_name}[#{index}]"
|
|
27
|
+
end
|
|
28
|
+
|
|
25
29
|
def check_one(value, attribute_name)
|
|
26
30
|
return if !value.respond_to?(:valid?) || !value.respond_to?(:errors) || value.errors.nil? || value.valid?
|
|
27
31
|
value.errors.full_messages.each do |message|
|
data/lib/ph_model/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ph_model
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Piotr Banasik
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-12-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
232
232
|
version: '0'
|
|
233
233
|
requirements: []
|
|
234
234
|
rubyforge_project:
|
|
235
|
-
rubygems_version: 2.
|
|
235
|
+
rubygems_version: 2.6.13
|
|
236
236
|
signing_key:
|
|
237
237
|
specification_version: 4
|
|
238
238
|
summary: ph-model -- active_model, active_attr brought together at last
|