Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make filter_parameters work correctly with array parameters.

Conflicts:

	actionpack/lib/action_controller/base/filter_parameter_logging.rb
  • Loading branch information...
commit 9407f6e9a428b37517fdd779eac15e4f77bb4b71 1 parent 6720b25
@NZKoz NZKoz authored
View
4 actionpack/lib/action_controller/base.rb
@@ -491,6 +491,10 @@ def filter_parameter_logging(*filter_words, &block)
filtered_parameters[key] = '[FILTERED]'
elsif value.is_a?(Hash)
filtered_parameters[key] = filter_parameters(value)
+ elsif value.is_a?(Array)
+ filtered_parameters[key] = value.collect do |item|
+ filter_parameters(item)
+ end
elsif block_given?
key = key.dup
value = value.dup if value
View
3  actionpack/test/controller/filter_params_test.rb
@@ -23,7 +23,8 @@ def test_filter_parameters
[{'foo'=>'bar', 'bar'=>'foo'},{'foo'=>'[FILTERED]', 'bar'=>'foo'},%w'foo baz'],
[{'foo'=>'bar', 'baz'=>'foo'},{'foo'=>'[FILTERED]', 'baz'=>'[FILTERED]'},%w'foo baz'],
[{'bar'=>{'foo'=>'bar','bar'=>'foo'}},{'bar'=>{'foo'=>'[FILTERED]','bar'=>'foo'}},%w'fo'],
- [{'foo'=>{'foo'=>'bar','bar'=>'foo'}},{'foo'=>'[FILTERED]'},%w'f banana']]
+ [{'foo'=>{'foo'=>'bar','bar'=>'foo'}},{'foo'=>'[FILTERED]'},%w'f banana'],
+ [{'baz'=>[{'foo'=>'baz'}]}, {'baz'=>[{'foo'=>'[FILTERED]'}]}, %w(foo)]]
test_hashes.each do |before_filter, after_filter, filter_words|
FilterParamController.filter_parameter_logging(*filter_words)
Please sign in to comment.
Something went wrong with that request. Please try again.