aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2011-01-23 20:29:03 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2011-01-23 20:29:03 +0530
commit340c7d182e3eabf7fd514d4c9697fbf550a22d2d (patch)
tree735712e99efcb21005426ebb3e8f42c2b0daa645
parent6641bf877a8408eb28d76077bb0a346a97465485 (diff)
downloadrails-340c7d182e3eabf7fd514d4c9697fbf550a22d2d.tar.gz
rails-340c7d182e3eabf7fd514d4c9697fbf550a22d2d.tar.bz2
rails-340c7d182e3eabf7fd514d4c9697fbf550a22d2d.zip
filter_parameter_logging => config.filter_parameters
-rw-r--r--railties/guides/source/action_controller_overview.textile8
1 files changed, 2 insertions, 6 deletions
diff --git a/railties/guides/source/action_controller_overview.textile b/railties/guides/source/action_controller_overview.textile
index 8f9afb9c6d..be015c4f9b 100644
--- a/railties/guides/source/action_controller_overview.textile
+++ b/railties/guides/source/action_controller_overview.textile
@@ -737,16 +737,12 @@ GET /clients/1.pdf
h3. Parameter Filtering
-Rails keeps a log file for each environment 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":
+Rails keeps a log file for each environment 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. You can filter certain request parameters from your log files by appending them to <tt>config.filter_parameters</tt> in the application configuration. These parameters will be marked [FILTERED] in the log.
<ruby>
-class ApplicationController < ActionController::Base
- filter_parameter_logging :password
-end
+config.filter_parameters << :password
</ruby>
-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 turn and replaces those for which the block returns true.
-
h3. Rescue
Most likely your application is going to contain bugs or otherwise throw an exception that needs to be handled. For example, if the user follows a link to a resource that no longer exists in the database, Active Record will throw the +ActiveRecord::RecordNotFound+ exception.