tidy_strong_params 1.0.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -5
- data/lib/tidy_strong_params/resource.rb +1 -1
- data/lib/tidy_strong_params/version.rb +1 -1
- data/tidy_strong_params.gemspec +2 -2
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39896bf89f11502e5aec0df759c4454c4c86fcb410da9570b13870e0f9e0e891
|
4
|
+
data.tar.gz: e6c98dc372e3bf7a7bbec8355082fd6b1121bc6b6aa1e272dabaebf7e6142f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e89ccb18acbe1bfb5bfbbab1223c5c9e82747d8790c1f19382a089caab17757215699597ecc11ffdd3fde00febf1ff1f213cc63e31cd37d8a646fe2c3ac4d3a
|
7
|
+
data.tar.gz: 242f41089142eff0c56b3a090511eb54aac160937073eb4584599e0329629928586082ac3bd384efb21981e07f0835f6f651f263d14b5f2ef8b1dbbb6bf8a8e9
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -45,7 +45,7 @@ The `params` helper method takes the list of parameters you would usually pass a
|
|
45
45
|
|
46
46
|
##### params (instance method)
|
47
47
|
|
48
|
-
The params class method above is the
|
48
|
+
The params class method above is the simplest and cleanest way to pass a list of permitted attributes. However if you require more control eg. (conditionally permit params) then you can define your own `params` instance method which should return an array of permitted attributes. eg.
|
49
49
|
|
50
50
|
```
|
51
51
|
class BookStrongParams < TidyStrongParams::StrongParams
|
@@ -65,7 +65,7 @@ end
|
|
65
65
|
It overrides anything built using the `params` class method
|
66
66
|
|
67
67
|
##### `required` (Class method)
|
68
|
-
By default params are required to be nested under
|
68
|
+
By default params are required to be nested under their resource name. eg. for the books controller it would be equivalent of calling `params.require(:books)`. The name of this required parameter can be changed of disabled (pass false) using the `required` class method.
|
69
69
|
|
70
70
|
```
|
71
71
|
class BookStrongParams < TidyStrongParams::StrongParams
|
@@ -79,7 +79,7 @@ expects `{ old_books: { tile: "", publisher: ''} }`
|
|
79
79
|
|
80
80
|
##### `tap_params` (instance method)
|
81
81
|
|
82
|
-
Allows you to tap into and tweak the list of permitted attributes before they are returned.
|
82
|
+
Allows you to tap into and tweak the list of permitted attributes before they are returned. The main difference between this and the params instance method, is this method is called after `require` and can be used in conjunction with the `params` class helper.
|
83
83
|
|
84
84
|
```
|
85
85
|
class BookStrongParams < TidyStrongParams::StrongParams
|
@@ -96,7 +96,7 @@ end
|
|
96
96
|
|
97
97
|
##### `restrict` (class method)
|
98
98
|
Although a `tidy_strong_params` method is injected into each controller the `TidyStrongParams::StrongParams` class can be used directly, just pass in the required `raw_params` argument to the `restrict` method.
|
99
|
-
Note resource_name is only needed if there is no `required` key declared on the BookStrongParams class. Scope is optional
|
99
|
+
Note `resource_name` is only needed if there is no `required` key declared on the BookStrongParams class. Scope is optional
|
100
100
|
|
101
101
|
```
|
102
102
|
Class BooksController < ApplicationController
|
@@ -115,7 +115,7 @@ end
|
|
115
115
|
|
116
116
|
#### `tidy_params_scope` (Class method added to controllers)
|
117
117
|
|
118
|
-
As scope for TSP can be set at the controller level which is then passed to the `StrongParams` class. Useful for passing things like `current_user`. If the same scope is used everywhere then may best to set `tidy_params_scope` on the `ApplicationController
|
118
|
+
As scope for TSP can be set at the controller level which is then passed to the `StrongParams` class. Useful for passing things like `current_user`. If the same scope is used everywhere then may best to set `tidy_params_scope` on the `ApplicationController`.
|
119
119
|
|
120
120
|
```
|
121
121
|
Class BooksController < ApplicationController
|
data/tidy_strong_params.gemspec
CHANGED
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ['lib']
|
28
28
|
|
29
29
|
spec.add_runtime_dependency 'rails', '>= 5'
|
30
|
-
spec.add_development_dependency 'bundler', '
|
31
|
-
spec.add_development_dependency 'rake', '~>
|
30
|
+
spec.add_development_dependency 'bundler', '>= 1.16'
|
31
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
32
32
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
33
33
|
spec.add_development_dependency 'rspec-rails', '~> 3.0'
|
34
34
|
spec.add_development_dependency 'simplecov'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tidy_strong_params
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonny Wheeler
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.16'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.16'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 12.3.3
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 12.3.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,7 +131,7 @@ homepage: https://github.com/yak-shak/tidy_strong_params
|
|
131
131
|
licenses:
|
132
132
|
- MIT
|
133
133
|
metadata: {}
|
134
|
-
post_install_message:
|
134
|
+
post_install_message:
|
135
135
|
rdoc_options: []
|
136
136
|
require_paths:
|
137
137
|
- lib
|
@@ -146,9 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
|
-
|
150
|
-
|
151
|
-
signing_key:
|
149
|
+
rubygems_version: 3.0.8
|
150
|
+
signing_key:
|
152
151
|
specification_version: 4
|
153
152
|
summary: Tidies up after your strong params
|
154
153
|
test_files: []
|