Class: Importable::ResourcesController

Inherits:
ImporterController show all
Defined in:
app/controllers/importable/resources_controller.rb

Instance Method Summary collapse

Methods inherited from ImporterController

#importer_class, #importer_name, #init_import_params, #map_specific_path, #new, #prepend_map_specific_view_path, #require_type_param, #return_url, #show

Instance Method Details

#createObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/importable/resources_controller.rb', line 3

def create
  started_at = Time.now

  init_resource
  init_import_params

  if @importer.save and @importer.import!
    redirect_to return_url, notice: return_notice, flash: { start: started_at.to_f, end: Time.now.to_f }
    return
  end

  # if not redirected
  render action: 'new'
end