Class: SmartCsvImport::Import

Inherits:
Object
  • Object
show all
Defined in:
app/models/smart_csv_import/import.rb

Overview

Parent resolved at class-definition time; set SmartCsvImport.base_model_class in an initializer before this model is autoloaded if you want a custom AR subclass.

Constant Summary collapse

STATUSES =
%w[pending mapping_review processing completed partial_failure failed].freeze

Class Method Summary collapse

Class Method Details

.find_duplicate(file_hash:, import_type: nil) ⇒ Object



28
29
30
31
32
33
34
# File 'app/models/smart_csv_import/import.rb', line 28

def self.find_duplicate(file_hash:, import_type: nil)
  return nil if file_hash.nil?

  scope = where(file_hash: file_hash)
  scope = scope.where(import_type: import_type) if import_type
  scope.first
end