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_to_batch, #flush, #id_map_record_batch, #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.



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

def initialize(collection, options={})
  super
  @insert_options.merge!(on_conflict: { column: remap_ids? ? :legacy_id : :id, do: :update })
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