Skip to content

Instantly share code, notes, and snippets.

@coryodaniel
Created August 16, 2016 14:27
Show Gist options
  • Select an option

  • Save coryodaniel/af737849bbb071ea3877476db0c9d1f7 to your computer and use it in GitHub Desktop.

Select an option

Save coryodaniel/af737849bbb071ea3877476db0c9d1f7 to your computer and use it in GitHub Desktop.
Using Rails params filter on an arbitrary hash
filters = Rails.application.config.filter_parameters
f = ActionDispatch::Http::ParameterFilter.new filters
f.filter user:{password: 'haha’} # => user: {:password=>"[FILTERED]"}
f.filter :password => 'haha' # => {:password=>"[FILTERED]"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment