before_save我的模型中有一个Message这样定义的:
class Message < ActiveRecord::Base
before_save lambda { foo(publisher); bar }
end
当我做:
my_message.update_attributes(:created_at => ...)
foo并被bar执行。
有时,我想在不执行fooand的情况下更新消息的字段bar。
例如,如何在不执行and的情况下更新created_at字段(在数据库中)?foobar