我創建使用此聲明數組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