Skip to content

Commit 55d0e6f

Browse files
committed
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
1 parent 8c147bc commit 55d0e6f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

actionpack/lib/action_controller/metal/strong_parameters.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ def array_of_permitted_scalars?(value)
649649
end
650650

651651
def array_of_permitted_scalars_filter(params, key)
652-
if has_key?(key) && array_of_permitted_scalars?(self[key])
652+
if array_of_permitted_scalars?(self[key])
653653
params[key] = self[key]
654654
end
655655
end
@@ -661,6 +661,7 @@ def hash_filter(params, filter)
661661
# Slicing filters out non-declared keys.
662662
slice(*filter.keys).each do |key, value|
663663
next unless value
664+
next unless has_key? key
664665

665666
if filter[key] == EMPTY_ARRAY
666667
# Declaration { comment_ids: [] }.

0 commit comments

Comments
 (0)