Rails回调在模型中发生了变化

时间:2012-08-13 15:48:13

标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-3.1

这里我想验证我的模型中的属性是否已更改

模型列

Customer
ID
First
Last
curr_gender

模型

  before_update :gender_changed
    protected
    def gender_changed
      self.curr_gender.changed?
        #do code
    end

但我猜是以下错误

NoMethodError in CustomersController#update

undefined method `changed?' for "2":String

谢谢!

1 个答案:

答案 0 :(得分:0)

我认为这是curr_gender_changed?