I need to mass-update many thousands of records, and I would like to process the updates in batches. First, I tried:
Foo.where(bar: \'bar\').find_in_batches.upda
Haven't had a chance to test this yet but you might be able to use ARel and a sub query.
Foo.where(bar: 'bar').select('id').find_in_batches do |foos| Foo.where( Foo.arel_table[ :id ].in( foos.to_arel ) ).update_all(bar: 'baz') end