Class: CSVStepImporter::Model::ImportableModel

Inherits:
Model show all
Defined in:
lib/csv_step_importer/model/importable_model.rb

Instance Attribute Summary

Attributes inherited from Model

#dao_values

Attributes inherited from Node

#children, #env, #parent

Instance Method Summary collapse

Methods inherited from Model

#add_daos, #build_daos_for_row, cache_key, #columns, #dao_class, #dao_node, #daos, #initialize, #link_rows_to_daos

Methods inherited from Node

#add_children, #create_or_update, #initialize, #validate_children

Methods inherited from Base

#assign_attributes, #create_or_update, #inspect, #persisted?, #save, #save!, #to_s, #update

Constructor Details

This class inherits a constructor from CSVStepImporter::Model::Model

Instance Method Details

#add_model_childrenObject

Logic



48
49
50
# File 'lib/csv_step_importer/model/importable_model.rb', line 48

def add_model_children
  add_children [dao_node, importer_class, reflector_class], prepend: true
end

#finder_keysObject

example: [:email]



29
30
31
# File 'lib/csv_step_importer/model/importable_model.rb', line 29

def finder_keys
  raise "please extend and implement"
end

#finder_scopeObject

example: env.company_users



24
25
26
# File 'lib/csv_step_importer/model/importable_model.rb', line 24

def finder_scope
  model_class.all
end

#importer_classObject



15
16
17
# File 'lib/csv_step_importer/model/importable_model.rb', line 15

def importer_class
  CSVStepImporter::Model::Importer
end

#model_classObject

example: User



11
12
13
# File 'lib/csv_step_importer/model/importable_model.rb', line 11

def model_class
  raise "please extend and implement"
end

#on_duplicate_key_ignoreObject



34
35
36
# File 'lib/csv_step_importer/model/importable_model.rb', line 34

def on_duplicate_key_ignore
  false
end

#on_duplicate_key_updateObject



40
41
42
# File 'lib/csv_step_importer/model/importable_model.rb', line 40

def on_duplicate_key_update
  raise "please extend and implement"
end

#reflector_classObject



19
20
21
# File 'lib/csv_step_importer/model/importable_model.rb', line 19

def reflector_class
  CSVStepImporter::Model::Reflector
end