Class: I18nAdmin::Import::Job

Inherits:
Object
  • Object
show all
Includes:
SuckerPunch::Job
Defined in:
lib/i18n_admin/import/job.rb

Instance Method Summary collapse

Instance Method Details

#perform(locale, file_path, job_id) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/i18n_admin/import/job.rb', line 6

def perform(locale, file_path, job_id)
  ActiveRecord::Base.connection_pool.with_connection do
    import = Import::XLS.new(locale, file_path)
    job = I18nAdmin::ImportJob.find(job_id)

    state = import.run ? 'success' : 'error'
    job.update(state: state)
  end
end