stronger_parameters 2.16.0 → 2.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stronger_parameters/parameters.rb +7 -1
- data/lib/stronger_parameters/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29a714a242ff378f5bf21a4a131c2c1e985e07d99a6698ec74a9c09009d201c6
|
4
|
+
data.tar.gz: eb48fa058692ca09457c04f2dd29ddb0addeb90cf40d17496c1eb62f7b2a53b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc0642f85f672bf56faf7e139e1ea895206a6985f7b8b7a4c5034e1bd023696af0796307fa478007c462c39f2d3dc47fdc769269990e4b0c5be51691709e0d54
|
7
|
+
data.tar.gz: 133a07b885c0a2d7612e5a8b46c9c53b05534a9be921738a571f910ea6de9c166bebb1891640537e707aa5c6b96fec234cddccde2a860b03d6e0cbff9d5da3d6
|
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'action_pack'
|
3
3
|
|
4
4
|
require 'action_controller/base'
|
5
|
+
require 'action_controller/api'
|
5
6
|
require 'action_controller/metal/strong_parameters'
|
6
7
|
|
7
8
|
require 'stronger_parameters/constraints'
|
@@ -190,7 +191,11 @@ module StrongerParameters
|
|
190
191
|
# TODO: this is not consistent with the behavior of raising ActionController::UnpermittedParameters
|
191
192
|
# should have the same render vs raise behavior in test/dev ... see permitted_parameters_test.rb
|
192
193
|
rescue_from(StrongerParameters::InvalidParameter) do |e|
|
193
|
-
|
194
|
+
if request.format.to_s.include?('json')
|
195
|
+
render json: { error: e.message }, status: :bad_request
|
196
|
+
else
|
197
|
+
render plain: e.message, status: :bad_request
|
198
|
+
end
|
194
199
|
end
|
195
200
|
end
|
196
201
|
end
|
@@ -198,3 +203,4 @@ end
|
|
198
203
|
|
199
204
|
ActionController::Parameters.include StrongerParameters::Parameters
|
200
205
|
ActionController::Base.include StrongerParameters::ControllerSupport
|
206
|
+
ActionController::API.include StrongerParameters::ControllerSupport
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stronger_parameters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mick Staugaard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -200,7 +200,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
200
200
|
requirements:
|
201
201
|
- - ">="
|
202
202
|
- !ruby/object:Gem::Version
|
203
|
-
version: 2.
|
203
|
+
version: 2.7.0
|
204
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
206
|
- - ">="
|