diff options
author | Benjamin Quorning <benjamin@quorning.net> | 2016-02-17 14:44:32 +0100 |
---|---|---|
committer | Benjamin Quorning <benjamin@quorning.net> | 2016-02-19 09:18:08 +0100 |
commit | 08fd9f4f1174ce20f8ecbcda1c2509bb598ce200 (patch) | |
tree | bf7cd3c5a02ea21684e1f80305b2d9235957db37 /actionpack/lib | |
parent | 9d2ea7f623711d13cfcf536de61012f4879c344b (diff) | |
download | rails-08fd9f4f1174ce20f8ecbcda1c2509bb598ce200.tar.gz rails-08fd9f4f1174ce20f8ecbcda1c2509bb598ce200.tar.bz2 rails-08fd9f4f1174ce20f8ecbcda1c2509bb598ce200.zip |
Fix AC::Parameters#== with other AC::Parameters
Creating a protected getter method for `@parameters`.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index e17189f9f9..3d3015ad07 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -144,11 +144,10 @@ module ActionController end # Returns true if another +Parameters+ object contains the same content and - # permitted flag, or other Hash-like object contains the same content. This - # override is in place so you can perform a comparison with `Hash`. + # permitted flag, or other Hash-like object contains the same content. def ==(other_hash) if other_hash.respond_to?(:permitted?) - super + self.permitted? == other_hash.permitted? && self.parameters == other_hash.parameters else if other_hash.is_a?(Hash) @parameters == other_hash.with_indifferent_access @@ -597,6 +596,8 @@ module ActionController end protected + attr_reader :parameters + def permitted=(new_permitted) @permitted = new_permitted end |