Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Add ActiveRecord::Relation#in_batches | Sina Siadat | 2015-08-07 | 1 | -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 |