-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
alias_attribute Rails deprecation warnings #11977
Comments
Hi @fdocr - that's correct, they were defined for backwards compatibility reasons. We didn't remove these aliases in 4.7, as we didn't want to introduce unnecessary breaking changes that would affect users' codebases. That said, I think the next version of Spree would be a good moment to sort this out :) These deprecations not a problem at this moment, and such warnings can be suppressed in Rails configuration if they cause too much noise in the logs. As for the solution - I'm leaning towards removing the aliases. I was planning to go through the aliased attributes one by one and verify if they're used in any meaningful way in both spree and spree-contrib repos. Given that the aliases are quite simple, I think anyone relying on them in their custom code should also be able to easily upgrade. |
That's great to hear @rafalcymerys, thank you for clarifying! |
All of these were fixed in v4.8! |
I wanted to create this issue to see if these deprecation warnings are known/expected on Spree.
Context
I first created a draft PR (here) to see how removing
alias_attribute :contact_email, :customer_support_email
onSpree::Store
model would affect the codebase. That wasn't an issue since this alias wasn't used throughout the project and other spree/spree-contrib gems.CI passed and this got rid of a loud warning message (printed many times on a single endpoint), but others remain that feel a bit trickier compared to "simply removing them". For example:
This PR in Rails has some more context on the
alias_attribute
deprecation warning.Expected Behavior
No
alias_attribute
deprecation warnings should appearActual Behavior
Plenty of warnings get printed on screen
Possible Fix
I think there are two ways out:
alias_attribute
declarationSpree::Price#price
fetch and assignment methods)alias_attribute
with an explicit methoddef price=(value); amount = price; end
Steps to Reproduce
4.7
appYour Environment
The text was updated successfully, but these errors were encountered: