Module: ActiveRecord::BatchesWithProgress
- Included in:
- Base
- Defined in:
- lib/progress/active_record.rb
Instance Method Summary collapse
- #find_each_with_progress(options = {}) ⇒ Object
- #find_in_batches_with_progress(options = {}) ⇒ Object
Instance Method Details
#find_each_with_progress(options = {}) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/progress/active_record.rb', line 4 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
14 15 16 17 18 19 20 21 22 |
# File 'lib/progress/active_record.rb', line 14 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 |