diff options
author | Joshua Peek <josh@joshpeek.com> | 2010-01-20 09:55:33 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2010-01-20 09:55:58 -0600 |
commit | 87bcf1aa15f8edb4287e1916b65a2c523f765e86 (patch) | |
tree | a70b52766cac796abbeb62a5af97e312a08672a2 /actionpack/lib | |
parent | f7d94cdc6d01617ff4579fda6a56a3e94be47ffe (diff) | |
download | rails-87bcf1aa15f8edb4287e1916b65a2c523f765e86.tar.gz rails-87bcf1aa15f8edb4287e1916b65a2c523f765e86.tar.bz2 rails-87bcf1aa15f8edb4287e1916b65a2c523f765e86.zip |
Request#filter_parameters and filter_env
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/http/parameters.rb | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb index 97546d5f93..68ba3637bf 100644 --- a/actionpack/lib/action_dispatch/http/parameters.rb +++ b/actionpack/lib/action_dispatch/http/parameters.rb @@ -29,9 +29,31 @@ module ActionDispatch def path_parameters @env["action_dispatch.request.path_parameters"] ||= {} end - - private + def filter_parameters + # TODO: Remove dependency on controller + if controller = @env['action_controller.instance'] + controller.send(:filter_parameters, params) + else + params + end + end + + def filter_env + if controller = @env['action_controller.instance'] + @env.map do |key, value| + if (key =~ /RAW_POST_DATA/i) + '[FILTERED]' + else + controller.send(:filter_parameters, {key => value}).values[0] + end + end + else + env + end + end + + private # Convert nested Hashs to HashWithIndifferentAccess def normalize_parameters(value) case value |