Are there any alternative ways for find_each method?

217 Views Asked by At

I have been using Rails 2.3.5.
I would like to use find_each method, but it is not in the version.

Are there any alternative ways to use find_each method for Active Record?

1

There are 1 best solutions below

1
felipeecst On BEST ANSWER

Try using find_in_batches:

Model.find_in_batches(:batch_size => 1000)  do |records|
    records.each { |record| <your logic here> }
end