Class: Para::Library::File

Inherits:
ApplicationRecord show all
Defined in:
app/models/para/library/file.rb

Instance Method Summary collapse

Methods inherited from ApplicationRecord

with_belongs_to_optional_option_if_needed

Instance Method Details

#attachment_extObject



19
20
21
# File 'app/models/para/library/file.rb', line 19

def attachment_ext
  ::File.extname(attachment.filename.to_s) if attachment.attached?
end

#attachment_pathObject

Return attachment.path or attachment.url depending on the storage backend, allowing ‘openuri’ and ‘roo’ libraries to load easily the file at the right path, on filesystem or othe storage systems, like S3.



11
12
13
14
15
# File 'app/models/para/library/file.rb', line 11

def attachment_path
  return unless attachment.attached?

  attachment.url
end

#attachment_urlObject

Return attachment.path or attachment.url depending on the storage backend, allowing ‘openuri’ and ‘roo’ libraries to load easily the file at the right path, on filesystem or othe storage systems, like S3.



17
18
19
20
21
# File 'app/models/para/library/file.rb', line 17

def attachment_path
  return unless attachment.attached?

  attachment.url
end