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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce9ec4b63f79317aa849950dcb6431c4fd0c3a5515abc3eb88aaa170f5680355
4
- data.tar.gz: 85cc4373897928267c81214cdf1ca1207a705ee93f32cc647be65c02c0dcbb56
3
+ metadata.gz: 29a714a242ff378f5bf21a4a131c2c1e985e07d99a6698ec74a9c09009d201c6
4
+ data.tar.gz: eb48fa058692ca09457c04f2dd29ddb0addeb90cf40d17496c1eb62f7b2a53b3
5
5
  SHA512:
6
- metadata.gz: 3f4bd6274fdf4a44431fbb1cf87e93ba2393c2d0e78c65d3fe6fe4afdde77f1abd6a7ff24e87216cb622ed43795f1900a10f825915f1bcb04f62ef5bd62eca2d
7
- data.tar.gz: 97d87e0b66db0f5c125b136385b379f72c4af95e17599c1a3f270ea0268af2f27d3532831b83f84b233492131962f9782ef35513963d1dde53ad73ad89e7e818
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
- render plain: e.message, status: :bad_request # uncovered
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module StrongerParameters
3
- VERSION = '2.16.0'
3
+ VERSION = '2.17.0'
4
4
  end
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.16.0
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-02-14 00:00:00.000000000 Z
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.5.0
203
+ version: 2.7.0
204
204
  required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - ">="