DEPRECATION WARNING in Rails 5.1
Closed this issue · 2 comments
The following warning appears in Rails 5.1 at saving of a new child in a tree (no problem in rails 5.0):
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.
The problem is caused by the following lines in lib/awesome_nested_set/model.rb
:
def store_new_parent
@move_to_new_parent_id = send("#{parent_column_name}_changed?") ? parent_id : false
true # force callback to return true
end
I've tried to change send("#{parent_column_name}_changed?")
to send("saved_change_to_#{parent_column_name}?
but it does not work at all. There is no deprecation warning, no error but the attributes lft
and rgt
are not updated if a new child saved.
🤔 tricky; is the new Rails behaviour of calling the callback after save
returned definitely a problem for us here?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.