0
我的模型:Before_save方法不叫
class MyModel < ActiveRecord::Base
before_save [:method1!, :method2!]
#..........
private
def method1!
puts 'method1'
end
def method2!
puts 'method2'
end
end
不是不叫出於某種原因,當我保存模型的方法method1
和method2
。我的代碼中是否有錯誤?
單獨調用時,這些方法是否工作(即'before_save:method1!'不使用數組)? –