Class: Para::Library::File

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/para/library/file.rb

Instance Method Summary collapse

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.service_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.service_url
end