Class: AbstractImporter::Strategies::UpsertStrategy
- Inherits:
-
InsertStrategy
- Object
- Base
- InsertStrategy
- AbstractImporter::Strategies::UpsertStrategy
- Defined in:
- lib/abstract_importer/strategies/upsert_strategy.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#already_imported?(hash) ⇒ Boolean
We won’t skip any records for already being imported.
-
#initialize(collection, options = {}) ⇒ UpsertStrategy
constructor
A new instance of UpsertStrategy.
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, ={}) 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
14 15 16 |
# File 'lib/abstract_importer/strategies/upsert_strategy.rb', line 14 def already_imported?(hash) false end |