Method: ActiveRecord::Batches::BatchEnumerator#destroy_all
- Defined in:
- activerecord/lib/active_record/relation/batches/batch_enumerator.rb
#destroy_all ⇒ Object
Destroys records in batches. Returns the total number of rows affected.
Person.where("age < 10").in_batches.destroy_all
See Relation#destroy_all for details of how each batch is destroyed.
96 97 98 99 100 |
# File 'activerecord/lib/active_record/relation/batches/batch_enumerator.rb', line 96 def destroy_all sum do |relation| relation.destroy_all.count(&:destroyed?) end end |