lib/arcopy/copy.rb
def copy_table_without_id(source_model, dest_model, bar)
      dest_model.primary_key = nil

      dest_model.transaction do
        batch = []

        source_model.all.each do |src_inst|
          batch << dest_model.new(src_inst.attributes)
        end

        batch.each_slice(BATCH_SIZE) do |arr|
          dest_model.import(arr)
          bar.progress += arr.size
        end
      end
    end
# Define two databases source & target
Define two databases source & target
Define two databases source & target
def copy_table_without_id(source_model, dest_model, bar)
      dest_model.primary_key = nil
      dest_model.transaction do
        batch = []
        source_model.all.each do |src_inst|
          batch << dest_model.new(src_inst.attributes)
        end
        batch.each_slice(BATCH_SIZE) do |arr|
          dest_model.import(arr)
          bar.progress += arr.size
        end
      end
    end
def copy_table_without_id ( source_model , dest_model , bar ) dest_model . primary_key = nil dest_model . transaction do batch = [ ] source_model . all . each do | src_inst | batch << dest_model . new ( src_inst . attributes ) end batch . each_slice ( BATCH_SIZE ) do | arr | dest_model . import ( arr ) bar . progress += arr . size end end end
Define two databases source & target
Define two databases source & target
source_model
dest_model
bar