diff options
author | Rafael França <rafael@franca.dev> | 2019-07-23 13:19:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-23 13:19:18 -0400 |
commit | d3327ca40eaea734b2302c7a9ffa0360033a7484 (patch) | |
tree | 03f45161d5d896a65b2415c0c4187b241045072b /activesupport/lib | |
parent | d8bda0170210101df448313dcbf4ddd118e90327 (diff) | |
parent | 479b8ae28d80335d034900edc4f3f9fc6b17751e (diff) | |
download | rails-d3327ca40eaea734b2302c7a9ffa0360033a7484.tar.gz rails-d3327ca40eaea734b2302c7a9ffa0360033a7484.tar.bz2 rails-d3327ca40eaea734b2302c7a9ffa0360033a7484.zip |
Merge pull request #36370 from ptoomey3/master
Add support for Proc based parameter filtering on arrays of values
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/parameter_filter.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/parameter_filter.rb b/activesupport/lib/active_support/parameter_filter.rb index 8e5595babf..e1cd7c46c1 100644 --- a/activesupport/lib/active_support/parameter_filter.rb +++ b/activesupport/lib/active_support/parameter_filter.rb @@ -109,7 +109,12 @@ module ActiveSupport elsif value.is_a?(Hash) value = call(value, parents, original_params) elsif value.is_a?(Array) - value = value.map { |v| v.is_a?(Hash) ? call(v, parents, original_params) : v } + # If we don't pop the current parent it will be duplicated as we + # process each array value. + parents.pop if deep_regexps + value = value.map { |v| value_for_key(key, v, parents, original_params) } + # Restore the parent stack after processing the array. + parents.push(key) if deep_regexps elsif blocks.any? key = key.dup if key.duplicable? value = value.dup if value.duplicable? |