aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorSteve Hull <sdhull@users.noreply.github.com>2018-04-16 12:50:18 -0700
committerSteve Hull <sdhull@users.noreply.github.com>2018-04-16 14:38:20 -0700
commite539f2d5850c00ba40514af9b8f1961b0f208fe6 (patch)
tree06cf768148d5020ac73a7dad5320f2b134bcf3dd /actionpack/lib
parent37b373a8d2a1cd132bbde51cd5a3abd4ecee433b (diff)
downloadrails-e539f2d5850c00ba40514af9b8f1961b0f208fe6.tar.gz
rails-e539f2d5850c00ba40514af9b8f1961b0f208fe6.tar.bz2
rails-e539f2d5850c00ba40514af9b8f1961b0f208fe6.zip
Fixes StrongParameters permit! to work with nested arrays
`permit!` is intended to mark all instances of `ActionController::Parameters` as permitted, however nested arrays of params were not being marked permitted because the method did shallow iteration. This fixes that by flattening the array before calling `permit!` on all each item.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index 4789252550..5a06bf86e3 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -374,7 +374,7 @@ module ActionController
# Person.new(params) # => #<Person id: nil, name: "Francesco">
def permit!
each_pair do |key, value|
- Array.wrap(value).each do |v|
+ Array.wrap(value).flatten.each do |v|
v.permit! if v.respond_to? :permit!
end
end