Reputation: 21
I have a method where I take in a model and result_size . The first thing i try to do in this method is:
array = model.logs.find_in_batches(:batch_size => result_size)
But this doesn't work; instead it returns "No Block Given (Yield)". I guess I'm just unfamiliar with blocks and yields. If anyone could help me understand/fix this problem I would greatly appreciate it!
Thanks in advance!
Upvotes: 2
Views: 2232
Reputation: 32037
find_in_batches
expects you to pass the values into a block, as so:
model.logs.find_in_batches(:batch_size => result_size) do |models|
models.each do |model|
model.do_something
end
end
Upvotes: 7