ActiveRecord::Batches

module ActiveRecord::Batches

Public Instance Methods

find_each(options = {}) { |record| ... } Show source

Looping through a collection of records from the database (using the all method, for example) is very inefficient since it will try to instantiate all the objects at once.

In that case, batch processing methods allow you to work with the records in batches, thereby greatly reducing memory consumption.

The find_each method uses 登录查看完整内容