This method is deprecated in Rails 5.1 because its behavior will be different in `before` and `after` callbacks. Here we're replacing the deprecated `attribute_changed?` and `attribute_was` with `will_save_change_to_attribute?` and `attribute_in_database` during `before_save` callbacks. https://github.com/rails/rails/pull/32835/