From 1cd24e5d009d0f9f5ecc3850614000473ecfdc8f Mon Sep 17 00:00:00 2001 From: Abhay Nikam Date: Thu, 25 Apr 2019 09:43:02 +0530 Subject: 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 --- activemodel/lib/active_model/errors.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activemodel') 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) -- cgit v1.2.3