Class: AbstractImporter::Strategies::UpsertStrategy

Inherits:
InsertStrategy show all
Defined in:
lib/abstract_importer/strategies/upsert_strategy.rb

Instance Attribute Summary

Attributes inherited from Base

#collection

Instance Method Summary collapse

Methods inherited from InsertStrategy

#add_batch_to_id_map, #add_to_batch, #cast_result, #flush, #insert_batch, #process_record

Methods inherited from Base

#flush, #prepare_attributes, #process_record, #remap_ids?

Constructor Details

#initialize(collection, options = {}) ⇒ UpsertStrategy

Returns a new instance of UpsertStrategy.



7
8
9
10
11
# File 'lib/abstract_importer/strategies/upsert_strategy.rb', line 7

def initialize(collection, options={})
  super
  @bulk_operation = :upsert_all
  @insert_options.reverse_merge!(unique_by: remap_ids? ? (association_attrs.keys + %i{legacy_id}) : :id)
end

Instance Method Details

#already_imported?(hash) ⇒ Boolean

We won’t skip any records for already being imported

Returns:

  • (Boolean)


14
15
16
# File 'lib/abstract_importer/strategies/upsert_strategy.rb', line 14

def already_imported?(hash)
  false
end