我创建使用此声明数组update_all ..问题关于Ruby的
users_who_promoted = @organization.card_signups.select {|c| c.credit_status == true }
,但是当我这样做:
users_who_promoted.update_all("credit_status = false")
我得到一个很大的错误:
NoMethodError: undefined method `update_all' for #<Array:0x32377bc>
from (irb):25
为什么是这样?
有趣......这似乎并不在我的版本的Rails(2.1.2)的工作,但我想这就是我得到了生活在石器时代。 – bnaul 2010-06-30 20:55:29
这是2.3.5 ..但是它基本上是你在直接使用这种方法时所建议的方法,这种方式与组织模型有关。 – Trip 2010-07-01 02:35:16