Rails find_each Uses Batches under the Hood

When you call find_each method, Ruby on Rails uses batch processing under the hood. See Active Record Batches.

Example:

Person.find_each(&:recover_from_last_night!)

Default batch size is 1000 but you can change it:

Person.find_each(batch_size: 50)

Leave a Reply

Your email address will not be published. Required fields are marked *