From 08fd9f4f1174ce20f8ecbcda1c2509bb598ce200 Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Wed, 17 Feb 2016 14:44:32 +0100 Subject: Fix AC::Parameters#== with other AC::Parameters Creating a protected getter method for `@parameters`. --- actionpack/lib/action_controller/metal/strong_parameters.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_controller/metal/strong_parameters.rb') 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 -- cgit v1.2.3