instance method update_all

Ruby on Rails 8.0.4

Since v6.1.7.10

Available in: v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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

updates req
Source
# File activerecord/lib/active_record/relation/batches/batch_enumerator.rb, line 75
      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 75 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Batches::BatchEnumerator

Type at least 2 characters to search.

↑↓ navigate · open · esc close