Class: Importeroo::Importer
- Inherits:
-
Struct
- Object
- Struct
- Importeroo::Importer
- Defined in:
- lib/importeroo/importer.rb
Defined Under Namespace
Classes: Field
Constant Summary collapse
- FIELDS_TO_EXCLUDE =
["created_at", "updated_at"]
Instance Attribute Summary collapse
-
#data_source ⇒ Object
Returns the value of attribute data_source.
-
#data_source_type ⇒ Object
Returns the value of attribute data_source_type.
-
#klass ⇒ Object
Returns the value of attribute klass.
Instance Method Summary collapse
Instance Attribute Details
#data_source ⇒ Object
Returns the value of attribute data_source
6 7 8 |
# File 'lib/importeroo/importer.rb', line 6 def data_source @data_source end |
#data_source_type ⇒ Object
Returns the value of attribute data_source_type
6 7 8 |
# File 'lib/importeroo/importer.rb', line 6 def data_source_type @data_source_type end |
#klass ⇒ Object
Returns the value of attribute klass
6 7 8 |
# File 'lib/importeroo/importer.rb', line 6 def klass @klass end |
Instance Method Details
#import! ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/importeroo/importer.rb', line 9 def import! ActiveRecord::Base.transaction do ActiveRecord::Base.connection.execute("DELETE FROM #{klass.table_name}") (2..data.last_row).each do |row_num| import_row! data.row(row_num) end end end |