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_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.



13
14
15
16
17
18
19
20
# File 'app/models/para/library/file.rb', line 13

def attachment_path
  return unless attachment?

  case attachment.options[:storage]
  when :filesystem then attachment.path
  else attachment.url
  end
end