class I18nAdmin::Import::Job

Public Instance Methods

perform(locale, file_path, job_id) click to toggle source
# 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