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 +4 -4
- data/README.md +15 -6
- data/lib/rails_param/param.rb +7 -0
- data/lib/rails_param/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56f00aeec606117bd98934ccda7efba20311033e
|
4
|
+
data.tar.gz: cbb9cd5665c61d9c99b6e49628d8e9835d7bc43b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6835426c7ad10f5a13add786e951d4330bc69c4be1590305fed564038602688b7854208c26a5426b4ab56ef04af37e278edeb12986512455470fc0f886ab3908
|
7
|
+
data.tar.gz: fab8ae3963f91d5dba8a35851f721a0391cbd77622a0422b9db6b470f31ebfc9deb13194dfedf76dad2f9ad40bd56f116772e5ad9dccdad626bb3744768e4c1b
|
data/README.md
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
# rails_param2
|
1
|
+
# rails_param2 [](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
|
-
[](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:
|
data/lib/rails_param/param.rb
CHANGED
@@ -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
|
data/lib/rails_param/version.rb
CHANGED
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.
|
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-
|
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/
|
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.
|
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
|