diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2016-02-19 15:59:09 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2016-02-19 15:59:09 -0800 |
commit | 0c9f5f56f7a1628c8c9ff3a91a52f17a15e31b26 (patch) | |
tree | 3818883184b07c64ba7e96f88cfc0f8734e54405 /actionpack/lib | |
parent | 8a5059383e7bf4bfe0bfd308ab511d578b1a6ce8 (diff) | |
parent | 2df891dccdcfbdfb176c55297589712ac379f87d (diff) | |
download | rails-0c9f5f56f7a1628c8c9ff3a91a52f17a15e31b26.tar.gz rails-0c9f5f56f7a1628c8c9ff3a91a52f17a15e31b26.tar.bz2 rails-0c9f5f56f7a1628c8c9ff3a91a52f17a15e31b26.zip |
Merge branch 'master' into treewip
* master:
eliminate warnings about multiple primary keys on habtm join tables
Add methods to array delegation from `Relation`
Fix button_to's params option to support nested names.
Dependencies clean up
Deprecate AC::Parameters#== with a Hash
Fix AC::Parameters#== with other AC::Parameters
Tests for AC::Parameters#==
better docs for ActiveSupport::TestCase#assert_nothing_raised
remove needless `debug_exception_response_format` config [ci skip]
partial pass over the API guide [ci skip]
Fix `unsubscribed` server side behavior
Use a semaphore to signal message availability
Fix master build
Remove github gems from the master bug report templates
Truncate ActionCable broadcast message to 300 chars
Remove unused require
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index e17189f9f9..25ec3cf5b6 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -144,17 +144,21 @@ 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`. - def ==(other_hash) - if other_hash.respond_to?(:permitted?) - super + # permitted flag. + def ==(other) + if other.respond_to?(:permitted?) + self.permitted? == other.permitted? && self.parameters == other.parameters + elsif other.is_a?(Hash) + ActiveSupport::Deprecation.warn <<-WARNING.squish + Comparing equality between `ActionController::Parameters` and a + `Hash` is deprecated and will be removed in Rails 5.1. Please only do + comparisons between instances of `ActionController::Parameters`. If + you need to compare to a hash, first convert it using + `ActionController::Parameters#new`. + WARNING + @parameters == other.with_indifferent_access else - if other_hash.is_a?(Hash) - @parameters == other_hash.with_indifferent_access - else - @parameters == other_hash - end + @parameters == other end end @@ -597,6 +601,8 @@ module ActionController end protected + attr_reader :parameters + def permitted=(new_permitted) @permitted = new_permitted end |