注释
# Updates all the attributes from the passed-in Hash and saves the record. If the object is invalid, the saving will
# fail and false will be returned.
代码
self.attributes = attributes
save
保存的是self.attributes就是我们传进去的hash, 所以貌似这儿要更新就要写上所有的字段.
------------------------------------------------
而update_attribute 只改一个字段其它的是不变的.
send(name.to_s + '=', value)
save
------------------------------------------------
所以我想可行的办法是取属性hash, 改动几个属性, 再传回去用update_attributes()更新
参考
http://qiezi.javaeye.com/blog/26630
[
本帖最后由 5swords 于 2008-4-9 18:41 编辑 ]