Module: ScribdFu::AttachmentFu::InstanceMethods

Defined in:
lib/scribd_fu/attachment_fu.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
# File 'lib/scribd_fu/attachment_fu.rb', line 9

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#file_pathObject

Yields the correct path to the file, either the local filename or the S3 URL.



24
25
26
# File 'lib/scribd_fu/attachment_fu.rb', line 24

def file_path
  public_filename =~ ScribdFu::S3 ? public_filename : "#{RAILS_ROOT}/public#{public_filename}"
end

#get_content_typeObject

Returns the content type for this model’s attachment.



19
20
21
# File 'lib/scribd_fu/attachment_fu.rb', line 19

def get_content_type
  self.content_type
end

#thumbnail_urlObject

Returns a URL for a thumbnail for this model’s attachment.



14
15
16
# File 'lib/scribd_fu/attachment_fu.rb', line 14

def thumbnail_url
  (ipaper_document && ipaper_document.thumbnail_url) || public_filename(:thumb)
end