aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2016-02-17 16:12:18 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2016-02-17 16:15:51 -0800
commit04b410f83350aa8a9b6f181cc7c37f2c2653300f (patch)
tree5d5efc45ebf86ac99483e084687dcc6695b9eed2 /actionpack/lib/action_controller/metal
parentf57092ad728fa1de06c4f5fd9d09dcc2c4738fd9 (diff)
downloadrails-04b410f83350aa8a9b6f181cc7c37f2c2653300f.tar.gz
rails-04b410f83350aa8a9b6f181cc7c37f2c2653300f.tar.bz2
rails-04b410f83350aa8a9b6f181cc7c37f2c2653300f.zip
fields_for_style needs to test for AC::Parameters
While iterating an AC::Parameters object, the object will mutate itself and stick AC::Parameters objects where there used to be hashes: https://github.com/rails/rails/blob/f57092ad728fa1de06c4f5fd9d09dcc2c4738fd9/actionpack/lib/action_controller/metal/strong_parameters.rb#L632 If you use `permit` after this iteration, the `fields_for_style` method wouldn't return true because the child objects are now AC::Parameters objects rather than Hashes. fixes #23701
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-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 89b4f12ef7..e17189f9f9 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -602,7 +602,7 @@ module ActionController
end
def fields_for_style?
- @parameters.all? { |k, v| k =~ /\A-?\d+\z/ && v.is_a?(Hash) }
+ @parameters.all? { |k, v| k =~ /\A-?\d+\z/ && (v.is_a?(Hash) || v.is_a?(Parameters)) }
end
private