Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak alias_attribute deprecation message #48795

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/attribute_methods.rb
Expand Up @@ -95,7 +95,7 @@ def alias_attribute_method_definition(code_generator, pattern, new_name, old_nam

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
Expand Down
4 changes: 2 additions & 2 deletions activerecord/test/cases/attribute_methods_test.rb
Expand Up @@ -1156,7 +1156,7 @@ def title_was
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

Expand All @@ -1183,7 +1183,7 @@ def title_was
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

Expand Down