rails_param2 0.10.1 → 0.10.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 223049a369f98836763542f05aad2afdc43babfe
4
- data.tar.gz: 5c1228c7e6e8487a456726526beb9a1c48bac282
3
+ metadata.gz: 56f00aeec606117bd98934ccda7efba20311033e
4
+ data.tar.gz: cbb9cd5665c61d9c99b6e49628d8e9835d7bc43b
5
5
  SHA512:
6
- metadata.gz: f8fd48990dc1a47770a7e787f9e49f04cf7aa4c4cb0fe7dda0edbd8359635de9073e6b5cbd6a4d78b85d4daa68e3c0dd4d592c2759697e4bb9784f46af806a8a
7
- data.tar.gz: 9efeaf9d4b382ca9779e8e3ec8100c1f3242f4be058384cf3cfabf25b66aa51ace45604de7c8092e9e78fdcdb8423f21c10e100f0cd434de0ee7f6bad16bc68b
6
+ metadata.gz: 6835426c7ad10f5a13add786e951d4330bc69c4be1590305fed564038602688b7854208c26a5426b4ab56ef04af37e278edeb12986512455470fc0f886ab3908
7
+ data.tar.gz: fab8ae3963f91d5dba8a35851f721a0391cbd77622a0422b9db6b470f31ebfc9deb13194dfedf76dad2f9ad40bd56f116772e5ad9dccdad626bb3744768e4c1b
data/README.md CHANGED
@@ -1,10 +1,6 @@
1
- # rails_param2
1
+ # rails_param2 [![Build Status](https://travis-ci.com/sanavy/rails_param2.svg?branch=master)](https://travis-ci.com/sanavy/rails_param2)
2
2
 
3
- forked from [nicolasblanco/rails_param](https://github.com/nicolasblanco/rails_param)
4
-
5
- _Parameter Validation & Type Coercion for Rails_
6
-
7
- [![Build Status](https://travis-ci.org/nicolasblanco/rails_param.svg?branch=master)](https://travis-ci.org/nicolasblanco/rails_param)
3
+ _Parameter Validation & Type Coercion for Rails_ (forked from [nicolasblanco/rails_param](https://github.com/nicolasblanco/rails_param))
8
4
 
9
5
  ## Introduction
10
6
 
@@ -139,6 +135,19 @@ param! :books_array, Array, required: true do |b|
139
135
  end
140
136
  ```
141
137
 
138
+ ### Rename parameters
139
+
140
+ Rename parameter `params[:question_set][:sections]` to `params[:question_set][:sections_attributes]` and
141
+ then rename parameter `params[:question_set][:sections_attributes][0][:delete]` to `params[:question_set][:sections_attributes][0][:_destroy]`
142
+
143
+ ```ruby
144
+ param! :question_set, Hash, required: true do |qs|
145
+ qs.param! :sections, Array, default: [], rename_to: :sections_attributes do |sc|
146
+ sc.param! :delete, :boolean, rename_to: :_destroy
147
+ end
148
+ end
149
+ ```
150
+
142
151
  ## Thank you
143
152
 
144
153
  Many thanks to:
@@ -53,6 +53,13 @@ module RailsParam
53
53
  recurse params[name], &block
54
54
  end
55
55
  end
56
+
57
+ # rename
58
+ if params[name] && options[:rename_to]
59
+ params[options[:rename_to]] = params.delete(name)
60
+ name = options[:rename_to]
61
+ end
62
+
56
63
  params[name]
57
64
 
58
65
  rescue InvalidParameterError => exception
@@ -1,3 +1,3 @@
1
1
  module RailsParam #:nodoc
2
- VERSION = "0.10.1"
2
+ VERSION = '0.10.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_param2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Blanco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-14 00:00:00.000000000 Z
11
+ date: 2018-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -77,7 +77,7 @@ files:
77
77
  - lib/rails_param/param.rb
78
78
  - lib/rails_param/version.rb
79
79
  - lib/rails_param2.rb
80
- homepage: http://github.com/shhavel/rails_param2
80
+ homepage: http://github.com/sanavy/rails_param2
81
81
  licenses:
82
82
  - MIT
83
83
  metadata: {}
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: 1.3.6
99
99
  requirements: []
100
100
  rubyforge_project:
101
- rubygems_version: 2.6.12
101
+ rubygems_version: 2.6.10
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Parameter Validation and Type Coercion for Rails