Module: HasUploadedFile

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/has_uploaded_file.rb

Overview

Model references to uploaded file

Instance Method Summary collapse

Instance Method Details

#attachment_nameObject



13
14
15
# File 'app/models/concerns/has_uploaded_file.rb', line 13

def attachment_name
  uploaded_file&.name
end

#attachment_sizeObject



17
18
19
# File 'app/models/concerns/has_uploaded_file.rb', line 17

def attachment_size
  uploaded_file&.file_size
end

#attachment_urlObject



21
22
23
24
25
# File 'app/models/concerns/has_uploaded_file.rb', line 21

def attachment_url
  return if uploaded_file&.attachment.blank?

  uploaded_file.attachment.url
end