Class: Tire::Model::Import::Strategy::Mongoid
- Inherits:
-
Object
- Object
- Tire::Model::Import::Strategy::Mongoid
- Includes:
- Base
- Defined in:
- lib/tire/model/import.rb
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
Methods included from Base
Instance Method Details
#import(&block) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/tire/model/import.rb', line 68 def import &block items = [] klass.all.each do |item| items << item if items.length % [:per_page] == 0 index.import items, , &block items = [] end end index.import items, , &block unless items.empty? self end |