aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/batches/batch_enumerator.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add ActiveRecord::Relation#in_batchesSina Siadat2015-08-071-0/+67
`in_batches` yields Relation objects if a block is given, otherwise it returns an instance of `BatchEnumerator`. The existing `find_each` and `find_in_batches` methods work with batches of records. The new API allows working with relation batches as well. Examples: Person.in_batches.each_record(&:party_all_night!) Person.in_batches.update_all(awesome: true) Person.in_batches.delete_all Person.in_batches.map do |relation| relation.delete_all sleep 10 # Throttles the delete queries end