Class: Tire::Model::Import::Strategy::Kaminari

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/tire/model/import.rb

Instance Attribute Summary

Attributes included from Base

#index, #klass, #options

Instance Method Summary collapse

Methods included from Base

#initialize

Instance Method Details

#import(&block) ⇒ Object


84
85
86
87
88
89
90
91
92
93
94
# File 'lib/tire/model/import.rb', line 84

def import &block
  current = 0
  page = 1
  while current < klass.count
    items = klass.page(page).per(options[:per_page])
    index.import items, options, &block
    current = current + items.size
    page += 1
  end
  self
end