Merge pull request #48795 from Shopify/tweak-alias-attribute-deprecation-message

Tweak `alias_attribute` deprecation message
This commit is contained in:
Eileen M. Uchitelle 2023-07-25 10:51:13 -04:00 committed by GitHub
commit 06e8bb5b4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -95,7 +95,7 @@ module ActiveRecord
ActiveModel.deprecator.warn(
"#{self} model aliases `#{old_name}` and has a method called `#{target_name}` defined. " \
"Since Rails 7.2 `#{method_name}` will not be calling `#{target_name}` anymore. " \
"Starting in Rails 7.2 `#{method_name}` will not be calling `#{target_name}` anymore. " \
"You may want to additionally define `#{method_name}` to preserve the current behavior."
)
super

View File

@ -1156,7 +1156,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase
test "#alias_attribute with an overridden original method issues a deprecation" do
message = <<~MESSAGE.gsub("\n", " ")
AttributeMethodsTest::ClassWithDeprecatedAliasAttributeBehavior model aliases `title` and has a method called
`title_was` defined. Since Rails 7.2 `subject_was` will not be calling `title_was` anymore.
`title_was` defined. Starting in Rails 7.2 `subject_was` will not be calling `title_was` anymore.
You may want to additionally define `subject_was` to preserve the current behavior.
MESSAGE
@ -1183,7 +1183,7 @@ class AttributeMethodsTest < ActiveRecord::TestCase
test "#alias_attribute with an overridden original method from a module issues a deprecation" do
message = <<~MESSAGE.gsub("\n", " ")
AttributeMethodsTest::ClassWithDeprecatedAliasAttributeBehaviorFromModule model aliases `title` and has a method
called `title_was` defined. Since Rails 7.2 `subject_was` will not be calling `title_was` anymore.
called `title_was` defined. Starting in Rails 7.2 `subject_was` will not be calling `title_was` anymore.
You may want to additionally define `subject_was` to preserve the current behavior.
MESSAGE