Class: CanvasSync::Importers::LegacyImporter

Inherits:
Object
  • Object
show all
Defined in:
lib/canvas_sync/importers/legacy_importer.rb

Class Method Summary collapse

Class Method Details

.import(report_file_path, klass, account_id) ⇒ 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.

Parameters:

  • report_file_path (String)
  • klass (Object)


10
11
12
13
14
# File 'lib/canvas_sync/importers/legacy_importer.rb', line 10

def self.import(report_file_path, klass, )
  CSV.foreach(report_file_path, headers: true, header_converters: :symbol) do |row|
    klass.create_or_update_from_csv(row, )
  end
end