diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-01 15:53:27 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-02-01 15:53:27 -0200 |
commit | e9be1c1e80f4e7efeb1c231505c28b95f901ff8b (patch) | |
tree | 1adbf02c147fffbb8fa15961b6a8f59a6625b338 /actionpack/lib | |
parent | 989923e5a413d7527a7f1cdf5f18da7ff36ea4cc (diff) | |
parent | 1f9586fd4725f5e81177cc6adba879b4869f71af (diff) | |
download | rails-e9be1c1e80f4e7efeb1c231505c28b95f901ff8b.tar.gz rails-e9be1c1e80f4e7efeb1c231505c28b95f901ff8b.tar.bz2 rails-e9be1c1e80f4e7efeb1c231505c28b95f901ff8b.zip |
Merge pull request #13863 from joshjordan/jsj-dont-throw-out-get-params
Do not discard query parameters on requests that use wrap_parameters
Conflicts:
actionpack/CHANGELOG.md
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal/params_wrapper.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/metal/params_wrapper.rb b/actionpack/lib/action_controller/metal/params_wrapper.rb index c9f1d8dcb4..2ca8955741 100644 --- a/actionpack/lib/action_controller/metal/params_wrapper.rb +++ b/actionpack/lib/action_controller/metal/params_wrapper.rb @@ -231,7 +231,12 @@ module ActionController # by the metal call stack. def process_action(*args) if _wrapper_enabled? - wrapped_hash = _wrap_parameters request.request_parameters + if request.parameters[_wrapper_key].present? + wrapped_hash = _extract_parameters(request.parameters) + else + wrapped_hash = _wrap_parameters request.request_parameters + end + wrapped_keys = request.request_parameters.keys wrapped_filtered_hash = _wrap_parameters request.filtered_parameters.slice(*wrapped_keys) @@ -259,14 +264,16 @@ module ActionController # Returns the list of parameters which will be selected for wrapped. def _wrap_parameters(parameters) - value = if include_only = _wrapper_options.include + { _wrapper_key => _extract_parameters(parameters) } + end + + def _extract_parameters(parameters) + if include_only = _wrapper_options.include parameters.slice(*include_only) else exclude = _wrapper_options.exclude || [] parameters.except(*(exclude + EXCLUDE_PARAMETERS)) end - - { _wrapper_key => value } end # Checks if we should perform parameters wrapping. |