Class: CSVStepImporter::Model::ImportableModel
- Defined in:
- lib/csv_step_importer/model/importable_model.rb
Instance Attribute Summary
Attributes inherited from Model
Attributes inherited from Node
Instance Method Summary collapse
-
#add_model_children ⇒ Object
Logic.
-
#finder_keys ⇒ Object
example: [:email].
-
#finder_scope ⇒ Object
example: env.company_users.
- #importer_class ⇒ Object
-
#model_class ⇒ Object
example: User.
- #on_duplicate_key_ignore ⇒ Object
-
#on_duplicate_key_update ⇒ Object
example [:email, :updated_at] see: github.com/zdennis/activerecord-import/wiki/On-Duplicate-Key-Update.
- #reflector_class ⇒ Object
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_children ⇒ Object
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_keys ⇒ Object
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_scope ⇒ Object
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_class ⇒ Object
15 16 17 |
# File 'lib/csv_step_importer/model/importable_model.rb', line 15 def importer_class CSVStepImporter::Model::Importer end |
#model_class ⇒ Object
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_ignore ⇒ Object
34 35 36 |
# File 'lib/csv_step_importer/model/importable_model.rb', line 34 def on_duplicate_key_ignore false end |
#on_duplicate_key_update ⇒ Object
example [:email, :updated_at] see: github.com/zdennis/activerecord-import/wiki/On-Duplicate-Key-Update
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_class ⇒ Object
19 20 21 |
# File 'lib/csv_step_importer/model/importable_model.rb', line 19 def reflector_class CSVStepImporter::Model::Reflector end |