diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-10-21 18:33:40 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-10-21 18:33:40 +0100 |
commit | a03e2b356c66ddc8809fa2b23a2a7d652f173b8b (patch) | |
tree | ab8552913475bf94a78e4cbfbae804b2ecd9eca2 /railties/doc/guides/source/actioncontroller_basics/parameter_filtering.txt | |
parent | 18542c9e00209679bdaacf64075819fb887ec856 (diff) | |
download | rails-a03e2b356c66ddc8809fa2b23a2a7d652f173b8b.tar.gz rails-a03e2b356c66ddc8809fa2b23a2a7d652f173b8b.tar.bz2 rails-a03e2b356c66ddc8809fa2b23a2a7d652f173b8b.zip |
Merge with docrails. Also add a rake task to generate guides in your rails application :
rake doc:guides
The rake task will generate guides inside doc/guides directory of your application. Open index.html to browse.
Diffstat (limited to 'railties/doc/guides/source/actioncontroller_basics/parameter_filtering.txt')
-rw-r--r-- | railties/doc/guides/source/actioncontroller_basics/parameter_filtering.txt | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/railties/doc/guides/source/actioncontroller_basics/parameter_filtering.txt b/railties/doc/guides/source/actioncontroller_basics/parameter_filtering.txt new file mode 100644 index 0000000000..c4577d4f6d --- /dev/null +++ b/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 link:http://api.rubyonrails.org/classes/ActionController/Base.html#M000837[filter_parameter_logging] method can be used to filter out sensitive information from the log. It works by replacing certain keys 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. |