Skip to content

Instantly share code, notes, and snippets.

@renato-zannon
Created March 20, 2014 19:21
Show Gist options
  • Save renato-zannon/9671738 to your computer and use it in GitHub Desktop.
Save renato-zannon/9671738 to your computer and use it in GitHub Desktop.
Fix rails 2.3 filter_parameter_logging for ruby 2.x
# The filter_parameter_logging method, used to filter request parameters
# (such as passwords) from the log, defines a protected method called
# filter_parameter when called. Its existence is later tested using
# respond_to?, without the include_private parameter. Due to the respond_to?
# behavior change, the method existence is never detected, and parameter
# filtering stops working.
require 'action_controller'
module ParameterFilterPatch
def respond_to?(method, include_private = false)
if method.to_s == 'filter_parameters'
include_private = true
end
super(method, include_private)
end
end
module ActionController
class Base
prepend ParameterFilterPatch
end
end
@tsoto111
Copy link

You are a saint Renato!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment