rails 5弃用消息“ DEPRECATION WARNING:在下一个版本的Rails中,回调后`changed'的行为将改变”

时间:2018-07-13 20:15:38

标签: ruby-on-rails-5 rails-upgrade

将rails版本升级到5。

控制台/ rspec中的

object.save导致了很多弃用消息。其中一些是:

DEPRECATION WARNING: The behavior of `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_changes.keys` instead. (called from block ******)
DEPRECATION WARNING: The behavior of `changed_attributes` 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_changes.transform_values(&:first)` instead. (called from block ******)
DEPRECATION WARNING: The behavior of `changes` 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_changes` instead. (called from block ******)
DEPRECATION WARNING: The behavior of `attribute_change` 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. (called from block ******)

是否有找到导致这些弃用消息的原因的方法?

我确实尝试挖掘撬宝石,但没有成功。

对象类中没有before_after_回调。

0 个答案:

没有答案