Class: CanvasSync::Importers::LegacyImporter
- Inherits:
-
Object
- Object
- CanvasSync::Importers::LegacyImporter
- Defined in:
- lib/canvas_sync/importers/legacy_importer.rb
Class Method Summary collapse
-
.import(report_file_path, klass, account_id, options) ⇒ Object
Does a legacy style import, row by row.
Class Method Details
.import(report_file_path, klass, account_id, options) ⇒ Object
Does a legacy style import, row by row. This will be invoked if you passed “legacy_support: true” when starting the sync. For this to work your models must have a ‘create_or_update_from_csv` class method defined.
10 11 12 13 14 15 16 |
# File 'lib/canvas_sync/importers/legacy_importer.rb', line 10 def self.import(report_file_path, klass, account_id, ) ClassCallbackExecutor.run_if_defined(klass, :sync_import) do CSV.foreach(report_file_path, headers: true, header_converters: :symbol) do |row| klass.create_or_update_from_csv(row, account_id, ) end end end |