Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

tsoto111 commented Mar 31, 2020

You are a saint Renato!

Loading

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