Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Missed backport for 3.2 #6973

Merged
merged 1 commit into from

2 participants

@route

It's related to #6050 but for 3.2 branch

@rafaelfranca rafaelfranca merged commit c7afc42 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 5, 2012
  1. @route

    Show in log correct wrapped keys

    route authored
This page is out of date. Refresh to see the latest.
View
3  actionpack/lib/action_controller/metal/params_wrapper.rb
@@ -194,7 +194,8 @@ def _set_wrapper_defaults(options, model=nil)
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
View
8 actionpack/test/controller/params_wrapper_test.rb
@@ -37,6 +37,14 @@ def teardown
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'
Something went wrong with that request. Please try again.