module UpdateInBatches
Constants
- VERSION
Public Instance Methods
update_in_batches(args)
click to toggle source
# File lib/update_in_batches.rb, line 5 def update_in_batches(args) size = args.delete(:batch_size) || 1000 scoped.select(:id) .find_in_batches(batch_size: size) do |batch| scoped.where(id: batch.map(&:id)) .update_all(args) end end