前景提要
HDC调试需求开发(15万预算),能者速来!>>>
Need to check if a block of attributes has changed before update in Rails
场景:使用 Active record 的 rails 项目
例如 user 表有个 name 字段,在更新用户名之前我们由于某种需求检测 name 字段是否被修改,那么我们通过 /modles/user.rb 产生的对象 user 来检测 name 字段是否被修改:
user.name_changed?
更多信息请参考 http://api.rubyonrails.org/classes/ActiveModel/Dirty.html