Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module ChewyPostgresCursorAdapter
- def import_scope(scope, options)
- result = true
- objects = []
- index = 0
- scope.each_instance(block_size: options[:batch_size]) do |instance|
- objects << instance
- if index >= options[:batch_size]
- result &= yield grouped_objects(objects)
- index = 0
- end
- index += 1
- end
- result
- end
- end
- Chewy::Type::Adapter::ActiveRecord.prepend(ChewyPostgresCursorAdapter)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement