ph_model 1.1.0 → 1.1.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: 45d4629bdc212f29675b3b25d5c86fb28688af9a
4
- data.tar.gz: 9cf7cbc3e9903b1c84ea2bc0b4de7e68edb71647
3
+ metadata.gz: a8bb10b5076969dde5de65f82075a828c82009f0
4
+ data.tar.gz: b5d265dbda5b2ccb53007fbf95396bb2bb34198d
5
5
  SHA512:
6
- metadata.gz: 5301189e640e50e16f1910f8d8b824b45439c6c221c6f4a0d9358cf18b1f744db8c1d4ae9ccb0a1a29142e49a2b70383bcfbf1f9be5a353d91aae481d38b7a0e
7
- data.tar.gz: c3e8f29ce56c2663900ec45d9a0ffae810b41df4d53b174796d1eb847e5b07898931b591ba06ccfaa38a66588e6e9f1eae9982acbd8f07888c45883bf705d3a8
6
+ metadata.gz: 0fd9bd0332175ab8b64654a3cf1c849cdc2a6451ea7f8956a2092ab0e03d82bef7880829627aef51321f8ba9d3b3958e2f037d4e01d4908c1095ea5808ed5b08
7
+ data.tar.gz: 5cfb58ad27a2c08b5ae85524f7553a05d1758fb16dbb660eab693b9b4a829e582d0fc144073cdd24e1eaa53452a95d69d70cb4cf35b88e2d25b507825cbe4150
@@ -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
  [![Code Climate](https://codeclimate.com/github/payrollhero/ph_model/badges/gpa.svg)](https://codeclimate.com/github/payrollhero/ph_model)
12
12
  [![Issue Count](https://codeclimate.com/github/payrollhero/ph_model/badges/issue_count.svg)](https://codeclimate.com/github/payrollhero/ph_model)
13
13
  [![Dependency Status](https://gemnasium.com/payrollhero/ph_model.svg)](https://gemnasium.com/payrollhero/ph_model)
14
+ [![Gem Version](https://badge.fury.io/rb/ph_model.svg)](https://badge.fury.io/rb/ph_model)
14
15
 
15
16
  This Gem basically marries ActiveModel and ActiveAttr is a nice package.
16
17
 
@@ -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, "#{attribute_name}[#{index}]")
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|
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module PhModel
3
- VERSION = '1.1.0'.freeze
3
+ VERSION = '1.1.1'.freeze
4
4
  end
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.0
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-05-23 00:00:00.000000000 Z
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.5.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