Sha256: ae2c647a7313ea903eaf5f7c767e168f87dac681226d878457aa7b72b2fbccf0

Contents?: true

Size: 449 Bytes

Versions: 16

Compression:

Stored size: 449 Bytes

Contents

class FileUpload < ApplicationRecord
  belongs_to :record, polymorphic: true
  has_one_attached :file

  delegate :open, :content_type, to: :file

  validates_presence_of :file
  validates_inclusion_of :scan_status, in: %w[uploaded scan_failed scanned quarantined]

  after_commit :scan

  def clean?
    scan_status == "scanned"
  end

  def filename
    file.filename.to_s
  end

  private

  def scan
    FileScanJob.perform_later self
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rails_template_18f-1.2.0 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-1.1.0 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-1.0.0 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.8.2 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.8.1 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.8.0 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.7.2 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.7.1 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.7.0 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.6.0 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.5.3 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.5.2 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.5.1 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.5.0 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.4.1 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb
rails_template_18f-0.4.0 lib/generators/rails_template18f/active_storage/templates/app/models/file_upload.rb