解决方法
鉴于您的问题中没有太多细节,我将假设您指的是ActiveRecord对象.要在所谓的“脏对象”上查看已更改的属性,您可以执行以下操作:
User.changed #=> ["name","email"] User.changes #=> { "name" => ["Joe","Joseph"] }
User.name_changed? #=> true User.name_change #=> ["Joe","Joseph"]
更多细节在这里:
http://ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-dirty-objects