Module: ActiveRecord::BatchesWithProgress
- Included in:
- Base
- Defined in:
- lib/progress/active_record.rb
Instance Method Summary collapse
-
#find_each_with_progress(options = {}) ⇒ Object
run ‘find_each` with progress.
-
#find_in_batches_with_progress(options = {}) ⇒ Object
run ‘find_in_batches` with progress.
Instance Method Details
#find_each_with_progress(options = {}) ⇒ Object
run ‘find_each` with progress
5 6 7 8 9 10 11 12 13 |
# File 'lib/progress/active_record.rb', line 5 def find_each_with_progress( = {}) Progress.start(name.tableize, count()) do find_each do |model| Progress.step do yield model end end end end |
#find_in_batches_with_progress(options = {}) ⇒ Object
run ‘find_in_batches` with progress
16 17 18 19 20 21 22 23 24 |
# File 'lib/progress/active_record.rb', line 16 def find_in_batches_with_progress( = {}) Progress.start(name.tableize, count()) do find_in_batches do |batch| Progress.step batch.length do yield batch end end end end |