X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Frailties%2Fdoc%2Fguides%2Fsource%2Factioncontroller_basics%2Fparameter_filtering.txt;fp=vendor%2Frails%2Frailties%2Fdoc%2Fguides%2Fsource%2Factioncontroller_basics%2Fparameter_filtering.txt;h=e29f631038ee7349d917fb1e1a8c08e4f0ae73ac;hb=d115f2e23823271635bad69229a42cd8ac68debe;hp=0000000000000000000000000000000000000000;hpb=37cb670bf3ddde90b214e591f100ed4446469484;p=depot.git diff --git a/vendor/rails/railties/doc/guides/source/actioncontroller_basics/parameter_filtering.txt b/vendor/rails/railties/doc/guides/source/actioncontroller_basics/parameter_filtering.txt new file mode 100644 index 0000000..e29f631 --- /dev/null +++ b/vendor/rails/railties/doc/guides/source/actioncontroller_basics/parameter_filtering.txt @@ -0,0 +1,14 @@ +== Parameter Filtering == + +Rails keeps a log file for each environment (development, test and production) in the "log" folder. These are extremely useful when debugging what's actually going on in your application, but in a live application you may not want every bit of information to be stored in the log file. The `filter_parameter_logging` method can be used to filter out sensitive information from the log. It works by replacing certain values in the `params` hash with "[FILTERED]" as they are written to the log. As an example, let's see how to filter all parameters with keys that include "password": + +[source, ruby] +------------------------- +class ApplicationController < ActionController::Base + + filter_parameter_logging :password + +end +------------------------- + +The method works recursively through all levels of the params hash and takes an optional second parameter which is used as the replacement string if present. It can also take a block which receives each key in return and replaces those for which the block returns true.