instance method
update_all
Ruby on Rails 7.0.10
Since v6.1.7.10Signature
update_all(updates)
Updates records in batches. Returns the total number of rows affected.
Person.in_batches.update_all("age = age + 1")
See Relation#update_all for details of how each batch is updated.
Parameters
-
updatesreq
Source
# File activerecord/lib/active_record/relation/batches/batch_enumerator.rb, line 72
def update_all(updates)
sum do |relation|
relation.update_all(updates)
end
end
Defined in activerecord/lib/active_record/relation/batches/batch_enumerator.rb line 72
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Batches::BatchEnumerator