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

Fix: DEPRECATION WARNING for Rails 5.1.4 #67

Closed
wants to merge 1 commit into from

Conversation

marcinwierzbicki
Copy link

As of Ruby on Rails 5.1, attribute_changed? ActiveRecord method will be deprecated.

The deprecation message:

DEPRECATION WARNING: The behavior of attribute_changed? inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after save returned (e.g. the opposite of what it returns now). To maintain the current behavior, use saved_change_to_attribute? instead.

Method saved_change_to_attribute? is recommended.

According to changes listed above I wants to rename parent_id_changed? method to saved_change_to_parent_id?.

@felixbuenemann
Copy link
Collaborator

Hello Marcin, thanks for you contribution!

It's not enough to just change the method, because it breaks backward-compatibility.

You need to add a check for ActiveRecord::VERSION::MAJOR >= 5 if the new methods were introduced in rails 5.0 or if they were introduced in 5.1 you also need to check for ActiveRecord::VERSION::MINOR.

@felixbuenemann
Copy link
Collaborator

felixbuenemann commented Sep 14, 2017

@marcinwierzbicki I have implemented a backwards-compatible version of your changes in #68 and released gem version 2.7.0 with the fixes.

george-carlin added a commit to dradis/dradis-ce that referenced this pull request Apr 9, 2018
2.6.1 has a deprecation warning on Rails 5.1+, see
amerine/acts_as_tree#67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants