In Rails 5, there’s a new handy method ActiveRecord::Relation#in_batches to solve this problem:
Foo.in_batches.update_all(bar: 'baz')
Check documentation for details.
In Rails 5, there’s a new handy method ActiveRecord::Relation#in_batches to solve this problem:
Foo.in_batches.update_all(bar: 'baz')
Check documentation for details.