ActiveRecord#update
and ActiveRecord#update!
were added as aliases for update_attributes and update_attributes! in Rails 4
This soft deprecation was added to align with other Active Record
methods like create
and provide better semantics when a resource is being updated.
Using update_attributes
didn’t give any deprecation warning until Rails 5.2.
Rails 6 deprecates update_attributes and update_attributes!
in favour of update
and update!
and we can now see deprecation warning when invoked.
Before Rails 6
In Rails 6
Removing these methods will break code in many gems as a lot of developers have used update_attributes
over update
.
With this deprecation warning, everyone can start using the preferred way of updating record i.e. update
.
The methods update_attributes
and update_attributes!
will be removed entirely in the next version, Rails 6.1.