3
我从表单中传递4个值。还原属性的更改
attr1
attr2
attr3
attr4
在before_save
def before_save
if condition == true
# here i want to revert changes of attributes ...
# Right now i am doing this for reverting....
self.attr1 = self.attr1_was
self.attr2 = self.attr2_was
end
end
什么更好的办法来恢复除了一些属性的变化?我想恢复除一个或两个以外的所有属性。
我不想返回错误。无声地,我只想用最后的价值恢复它。 – 2010-09-22 19:31:49