4 ms·
This is what the `in_batches` method already does. See [1], which is called by the `in_batches` method for update operations. [1] https://api.rubyonrails.org/c
by revscat 3y ago
This is what the `in_batches` method already does. See [1], which is called by the `in_batches` method for update operations.
[1] https://api.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-update_all https://api.rubyonrails.org/classes/ActiveRecord/Relation.ht...
- strken 3y agoYou could use `in_batches` that way, but in the code from the article it looks like each call to `maximum`/`minimum` is causing a round trip, plus the `map` inside `MyService` is loading each batch into memory.