我試圖從Example here進行批處理。Active Record .where.find_each
Course.where("blocks != nil" && "blocks.size > 0").find_each do |course|
#logic on course variable
end
我得到這個錯誤:
method_missing': undefined method
find_each' for # (NoMethodError)
(blocks
是這當然是模型的類型陣列的屬性) 我檢查其中返回結果的一個數組,所以不應該有批量處理生成的數組上的find_each?我哪裏錯了?
您可以包括你的'Course'類的完整定義是什麼? – yez
它應該是這樣的'Course.find_each(條件:'塊不是null和大小> 0')'? – Todd