model.attributes = hash与model.attribute = value有什么区别?

时间:2012-07-23 08:53:00

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

之间有什么区别
t = Zombie.find(3)
t.attributes = {:graveyard => "Benny Hills Memorial"}
t.save

t = Zombie.find(3)
t.graveyard = "Benny Hills Memorial"
t.save

railsforzombies问题1.5。第一个起作用,第二个起作用。

1 个答案:

答案 0 :(得分:2)

graveyard属性可能不是attr_accessible