Sha256: f9e174358a25f32bb6ad321d05044bf41f166eca68f515b52ff44fce9e31449c
Contents?: true
Size: 630 Bytes
Versions: 2
Compression:
Stored size: 630 Bytes
Contents
if defined?(ActiveRecord::Base) module ActiveRecord module BatchesWithProgress def find_each_with_progress(options = {}) Progress.start(name.tableize, count(options)) do find_each do |model| yield model Progress.step end end end def find_in_batches_with_progress(options = {}) Progress.start(name.tableize, count(options)) do find_in_batches do |batch| yield batch Progress.step batch.length end end end end class Base extend BatchesWithProgress end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
progress-1.0.0 | lib/progress/active_record.rb |
progress-0.4.1 | lib/progress/active_record.rb |