From 55d0e6f87719bb9a7040d59db7e5beaa6701e55e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 17 Jul 2015 13:29:39 -0700 Subject: push key checking up We should disconnect `array_of_permitted_scalars_filter` from the instance so that we can make hash filtering functional. For now, pull the conditional up out of that method --- actionpack/lib/action_controller/metal/strong_parameters.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_controller/metal') diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index 4c979ad4ec..a989641cdb 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -649,7 +649,7 @@ module ActionController end def array_of_permitted_scalars_filter(params, key) - if has_key?(key) && array_of_permitted_scalars?(self[key]) + if array_of_permitted_scalars?(self[key]) params[key] = self[key] end end @@ -661,6 +661,7 @@ module ActionController # Slicing filters out non-declared keys. slice(*filter.keys).each do |key, value| next unless value + next unless has_key? key if filter[key] == EMPTY_ARRAY # Declaration { comment_ids: [] }. -- cgit v1.2.3