Sha256: fe3ac8adb9c042e4b8fa769eba61c1d8f191c3a4ddf48c964111405e3a265d8f

Contents?: true

Size: 553 Bytes

Versions: 16

Compression:

Stored size: 553 Bytes

Contents

module ActiveRecordCSVImporter
  # This Dsl extends a class that includes ActiveRecordCSVImporter
  # It is a thin proxy to the Config object
  module Dsl
    def model(model_klass)
      config.model = model_klass
    end

    def column(name, options = {})
      config.column_definitions << options.merge(name: name)
    end

    def on_duplicate_key(options)
      config.on_duplicate_key = options
    end

    def batch_size(size)
      config.batch_size = size
    end

    def each_batch(&block)
      config.each_batch(block)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
activerecord_csv_importer-0.4.0 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.3.0 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.2.3 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.2.2 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.2.1 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.2.0 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.1.9 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.1.8 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.1.7 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.1.6 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.1.5 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.1.4 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.1.3 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.1.2 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.1.1 lib/activerecord_csv_importer/dsl.rb
activerecord_csv_importer-0.1.0 lib/activerecord_csv_importer/dsl.rb