diff options
author | Abhay Nikam <nikam.abhay1@gmail.com> | 2019-04-25 09:43:02 +0530 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-04-25 13:13:01 +0900 |
commit | 1cd24e5d009d0f9f5ecc3850614000473ecfdc8f (patch) | |
tree | abf282efa7882ca0265767169e659632750942e4 /activemodel/lib/active_model | |
parent | 6f8db3d1f31b9e1fa39677fd6a4b4d60c1b8db5b (diff) | |
download | rails-1cd24e5d009d0f9f5ecc3850614000473ecfdc8f.tar.gz rails-1cd24e5d009d0f9f5ecc3850614000473ecfdc8f.tar.bz2 rails-1cd24e5d009d0f9f5ecc3850614000473ecfdc8f.zip |
Change the deprecation for Enumerating ActiveModel::Errors to Rails 6.1 instead of 6.0 (#36087)
* Change the deprecation for Enumerating ActiveModel::Errors to Rails 6.1 instead of 6.0
* Changed the deprecation message for ActiveModel::Errors methods: slice, values, keys and to_xml
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index a9af426fb1..fd87d3c9bc 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -229,9 +229,9 @@ module ActiveModel if block.arity == 1 @errors.each(&block) else - ActiveSupport::Deprecation.warn(<<-MSG.squish) + ActiveSupport::Deprecation.warn(<<~MSG) Enumerating ActiveModel::Errors as a hash has been deprecated. - In Rails 6, `errors` is an array of Error objects, + In Rails 6.1, `errors` is an array of Error objects, therefore it should be accessed by a block with a single block parameter like this: @@ -239,9 +239,9 @@ module ActiveModel error.full_message end - You are passing a block expecting 2 parameters, + You are passing a block expecting two parameters, so the old hash behavior is simulated. As this is deprecated, - this will result in an ArgumentError in Rails 6.1. + this will result in an ArgumentError in Rails 6.2. MSG @errors. sort { |a, b| a.attribute <=> b.attribute }. @@ -614,7 +614,7 @@ module ActiveModel end def deprecation_removal_warning(method_name) - ActiveSupport::Deprecation.warn("ActiveModel::Errors##{method_name} is deprecated and will be removed in Rails 6.1") + ActiveSupport::Deprecation.warn("ActiveModel::Errors##{method_name} is deprecated and will be removed in Rails 6.2") end def deprecation_rename_warning(old_method_name, new_method_name) |