instance method
destroy_all
Ruby on Rails 8.0.4
Since v6.1.7.10Signature
destroy_all()
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.
Source
# File activerecord/lib/active_record/relation/batches/batch_enumerator.rb, line 97
def destroy_all
sum do |relation|
relation.destroy_all.count(&:destroyed?)
end
end
Defined in activerecord/lib/active_record/relation/batches/batch_enumerator.rb line 97
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Batches::BatchEnumerator