解决方法
您可以使用
new_record?
来查看是否有一个全新的对象和
changed?
以查看是否有任何更改:
before_save :pancakes def pancakes if new_record? # Not in the database yet. elsif changed? # Already exists but it has unsaved changes. end end