diff options
author | Pavel Evstigneev <pavel.evst@gmail.com> | 2016-10-11 21:29:20 +0800 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-10-11 10:29:20 -0300 |
commit | f80ddf30dd4cc5e66c2caf2ef8e10608b13e8493 (patch) | |
tree | 2913414946ca51184ed3d9955e9c06ccf5fb50ad /actionpack/lib/action_controller/metal | |
parent | dae404473409fcab0e07976aec626df670e52282 (diff) | |
download | rails-f80ddf30dd4cc5e66c2caf2ef8e10608b13e8493.tar.gz rails-f80ddf30dd4cc5e66c2caf2ef8e10608b13e8493.tar.bz2 rails-f80ddf30dd4cc5e66c2caf2ef8e10608b13e8493.zip |
ActionController::Parameters#deep_dup (#26567)
* ActionController::Parameters#deep_dup
* Tests for ActionController::Parameters#deep_dup
* Fix test for ActionController::Parameters#deep_dup
* More tests for ActionController::Parameters#deep_dup
[Rafael Mendonça França + Pavel Evstigneev]
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index 4db30e64b4..b64617d084 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -613,6 +613,13 @@ module ActionController undef_method :to_param + # Returns duplicate of object including all parameters + def deep_dup + self.class.new(@parameters.deep_dup).tap do |duplicate| + duplicate.permitted = @permitted + end + end + protected attr_reader :parameters |