diff options
author | Marcel Molina <marcel@vernix.org> | 2006-04-29 16:34:23 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2006-04-29 16:34:23 +0000 |
commit | 0049bd729f71c804b4c930e38269aa5a40cca158 (patch) | |
tree | da67e66618ff42e7744aab5df69f88ca02bcaf8b /actionpack/lib/action_controller | |
parent | c745f4780442271a2a2dcead4567b3fec9057630 (diff) | |
download | rails-0049bd729f71c804b4c930e38269aa5a40cca158.tar.gz rails-0049bd729f71c804b4c930e38269aa5a40cca158.tar.bz2 rails-0049bd729f71c804b4c930e38269aa5a40cca158.zip |
Update README
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4307 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller')
-rwxr-xr-x | actionpack/lib/action_controller/base.rb | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index f0997e3f6a..77e5bba692 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -373,24 +373,26 @@ module ActionController #:nodoc: def filter_parameter_logging(*filter_words, &block) parameter_filter = Regexp.new(filter_words.collect{ |s| s.to_s }.join('|'), true) if filter_words.length > 0 - define_method(:filter_parameters) do |unfiltered_parameters| - filtered_parameters = {} - - unfiltered_parameters.each do |key, value| - if key =~ parameter_filter - filtered_parameters[key] = '[FILTERED]' - elsif value.is_a?(Hash) - filtered_parameters[key] = filter_parameters(value) - elsif block_given? - key, value = key.dup, value.dup - yield key, value - filtered_parameters[key] = value - else - filtered_parameters[key] = value + class << self + define_method(:filter_parameters) do |unfiltered_parameters| + filtered_parameters = {} + + unfiltered_parameters.each do |key, value| + if key =~ parameter_filter + filtered_parameters[key] = '[FILTERED]' + elsif value.is_a?(Hash) + filtered_parameters[key] = filter_parameters(value) + elsif block_given? + key, value = key.dup, value.dup + yield key, value + filtered_parameters[key] = value + else + filtered_parameters[key] = value + end end - end - filtered_parameters + filtered_parameters + end end end end |