Sha256: 97016f2bbb62ae8c5d692464e22eceeb197312d1c2ac2d7af66ff6ce3d66f451
Contents?: true
Size: 596 Bytes
Versions: 9
Compression:
Stored size: 596 Bytes
Contents
module MassInsert class Process attr_reader :values, :options def initialize(values, options) @values = values @options = options end def start ActiveRecord::Base.transaction do values.each_slice(per_batch).each do |batch| query = builder.build(batch, options) executer.execute(query) end end end private def builder @builder ||= Builder.new end def executer @executer ||= Executer.new end def per_batch options[:per_batch] || Utilities.per_batch end end end
Version data entries
9 entries across 9 versions & 1 rubygems