-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix strong params nested array objects being unpermitted (#3961)
* add rails backport for nested params * add spec for nested steps array with json objects
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
require_dependency 'gem_ext/doorkeeper/application' | ||
require 'gem_ext/doorkeeper/server' | ||
require 'gem_ext/doorkeeper/client_credentials_creator' | ||
|
||
require 'gem_ext/rails/strong_parameters' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
# backport the strong params nested array fix for permit! | ||
# that is fixed in 5.2+ https://github.com/rails/rails/pull/32593/ | ||
# landed in https://github.com/rails/rails/blob/v5.2.8.1/actionpack/CHANGELOG.md#rails-521-august-07-2018 | ||
if Gem::Version.new(Rails.version) < Gem::Version.new('5.2') | ||
module ActionController | ||
class Parameters | ||
def permit! | ||
each_pair do |key, value| | ||
Array.wrap(value).flatten.each do |v| | ||
v.permit! if v.respond_to? :permit! | ||
end | ||
end | ||
|
||
@permitted = true | ||
self | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters