From a2932784bb71e72a78c32819ebd7ed2bed551e3e Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 5 Oct 2008 22:16:26 +0100 Subject: Merge docrails --- .../doc/guides/actioncontroller/parameter_filtering.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 railties/doc/guides/actioncontroller/parameter_filtering.txt (limited to 'railties/doc/guides/actioncontroller/parameter_filtering.txt') diff --git a/railties/doc/guides/actioncontroller/parameter_filtering.txt b/railties/doc/guides/actioncontroller/parameter_filtering.txt new file mode 100644 index 0000000000..dce4b252c3 --- /dev/null +++ b/railties/doc/guides/actioncontroller/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":http://api.rubyonrails.org/classes/ActionController/Base.html#M000837 can be used to filter out sensitive information from the log. It works by replacing certain keys in the `params` hash with "[FILTERED]" before 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. -- cgit v1.2.3