class ActiveRecord::Base

Add find_each_with_progress and find_in_batches_with_progress method to ActiveRecord::Base

Public Instance Methods

find_each_with_progress(options = {}) { |model| ... } click to toggle source

run `find_each` with progress

# File lib/progress/active_record.rb, line 10
def find_each_with_progress(options = {})
  Progress.start(name.tableize, count(options)) do
    find_each do |model|
      Progress.step do
        yield model
      end
    end
  end
end
find_in_batches_with_progress(options = {}) { |batch| ... } click to toggle source

run `find_in_batches` with progress

# File lib/progress/active_record.rb, line 21
def find_in_batches_with_progress(options = {})
  Progress.start(name.tableize, count(options)) do
    find_in_batches do |batch|
      Progress.step batch.length do
        yield batch
      end
    end
  end
end