2012-01-18 61 views
0

我有一个activerecord模型。我想知道更新调用后更改了多少个属性。为我的模型获取未定义的方法publish_changed错误

这是我的模型

class User < ActiveRecord::Base 
    belongs_to :first_profile,:class_name => 'Profile',:foreign_key => :first_profile_id 
    accepts_nested_attributes_for :first_profile 
    attr_accessible :first_profile_attributes 
end 

class Profile < ActiveRecord::Base 
    belongs_to :user, :class_name => User 
    before_update :perform_task 
end 

代码代码当我更新或保存用户模型,它是被保存的第一,我得到空attributes_changes哈希当我perform_task函数内部的剖面模型。我试图使用published_changed但我得到未定义的函数错误。

谢谢

回答

0

尝试用published_changed?代替。

+0

这是我写的,我仍然有未定义的方法publish_changed?错误self.first_profile.published_changed? – user1095972 2012-01-19 06:04:04

相关问题