aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/import.rb
blob: 1a5062e2ab5efe63f6c7cc00dce9a4358c595f17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Import < ActiveRecord::Base
  mount_uploader :file, ImportUploader
  belongs_to :workbench
  belongs_to :referential

  extend Enumerize
  enumerize :status, in: %i(new downloading analyzing pending successful failed running aborted canceled)

  validates :file, presence: true

  before_create do
    self.token_download = SecureRandom.urlsafe_base64
    self.status = Import.status.new
  end
end