Created
August 16, 2016 14:27
-
-
Save coryodaniel/af737849bbb071ea3877476db0c9d1f7 to your computer and use it in GitHub Desktop.
Using Rails params filter on an arbitrary hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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