Sha256: 4f1d5aa7e4d8131433acb5ad9c115e68ca35b1974a68930061d9f6174bfe4526
Contents?: true
Size: 898 Bytes
Versions: 5
Compression:
Stored size: 898 Bytes
Contents
module AbstractImporter module Strategies class Base attr_reader :collection delegate :summary, :remap_foreign_keys!, :redundant_record?, :invoke_callback, :dry_run?, :id_map, :scope, :reporter, :association_attrs, to: :collection def initialize(collection) @collection = collection end def process_record(hash) raise NotImplementedError end def already_imported?(hash) id_map.contains? collection.table_name, hash[:id] end def flush end def prepare_attributes(hash) hash = invoke_callback(:before_build, hash) || hash legacy_id = hash.delete(:id) hash.merge(legacy_id: legacy_id).merge(association_attrs) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems