diff options
author | Dmitry Vorotilin <d.vorotilin@gmail.com> | 2012-04-29 19:16:32 +0400 |
---|---|---|
committer | Dmitry Vorotilin <d.vorotilin@gmail.com> | 2012-05-20 09:33:56 +0400 |
commit | 32a433e1c04264b891a4b4793ac0c75f0acaf9df (patch) | |
tree | f76eb7199aecc4bdca288a42c938d896bce3d11b | |
parent | da97cf016a8ffd1f54f804cd881f393e5d6efc18 (diff) | |
download | rails-32a433e1c04264b891a4b4793ac0c75f0acaf9df.tar.gz rails-32a433e1c04264b891a4b4793ac0c75f0acaf9df.tar.bz2 rails-32a433e1c04264b891a4b4793ac0c75f0acaf9df.zip |
Show in log correct wrapped keys
-rw-r--r-- | actionpack/lib/action_controller/metal/params_wrapper.rb | 3 | ||||
-rw-r--r-- | actionpack/test/controller/params_wrapper_test.rb | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/params_wrapper.rb b/actionpack/lib/action_controller/metal/params_wrapper.rb index 1f52c164de..aa67fa7f23 100644 --- a/actionpack/lib/action_controller/metal/params_wrapper.rb +++ b/actionpack/lib/action_controller/metal/params_wrapper.rb @@ -193,7 +193,8 @@ module ActionController def process_action(*args) if _wrapper_enabled? wrapped_hash = _wrap_parameters request.request_parameters - wrapped_filtered_hash = _wrap_parameters request.filtered_parameters + wrapped_keys = request.request_parameters.keys + wrapped_filtered_hash = _wrap_parameters request.filtered_parameters.slice(*wrapped_keys) # This will make the wrapped hash accessible from controller and view request.parameters.merge! wrapped_hash diff --git a/actionpack/test/controller/params_wrapper_test.rb b/actionpack/test/controller/params_wrapper_test.rb index fa1608b9df..5b05f77045 100644 --- a/actionpack/test/controller/params_wrapper_test.rb +++ b/actionpack/test/controller/params_wrapper_test.rb @@ -37,6 +37,14 @@ class ParamsWrapperTest < ActionController::TestCase UsersController.last_parameters = nil end + def test_filtered_parameters + with_default_wrapper_options do + @request.env['CONTENT_TYPE'] = 'application/json' + post :parse, { 'username' => 'sikachu' } + assert_equal @request.filtered_parameters, { 'controller' => 'params_wrapper_test/users', 'action' => 'parse', 'username' => 'sikachu', 'user' => { 'username' => 'sikachu' } } + end + end + def test_derived_name_from_controller with_default_wrapper_options do @request.env['CONTENT_TYPE'] = 'application/json' |