10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/acts_as_scrubbable/base_processor.rb', line 10
def scrub_query(query = nil)
scrubbed_count = 0
ActiveRecord::Base.connection_pool.with_connection do
if ar_class.respond_to?(:scrubbable_scope)
relation = ar_class.send(:scrubbable_scope)
else
relation = ar_class.all
end
relation.where(query).find_in_batches(batch_size: 1000) do |batch|
ActiveRecord::Base.transaction do
scrubbed_count += handle_batch(batch)
end
end
end
scrubbed_count
end
|