Class: Paperclip::Attachment

Inherits:
Object
  • Object
show all
Defined in:
lib/paperclip_mogilefs_storage_ennder/paperclip_attachment.rb

Instance Method Summary collapse

Instance Method Details

#mogilefs_get_paths(style = default_style) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/paperclip_mogilefs_storage_ennder/paperclip_attachment.rb', line 12

def mogilefs_get_paths style = default_style
  mogilefs = MogileFSConnect.connect_tracker
  url = original_filename.nil? ? interpolate(@default_url, style) : interpolate(@url, style)
  mogilefs.get_paths(url)
  rescue MogileFS::Backend::UnknownKeyError
    Paperclip.logger.error("[paperclip] Error: #{url} not found in MogileFS")
end

#mogilefs_url(style = default_style) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/paperclip_mogilefs_storage_ennder/paperclip_attachment.rb', line 4

def mogilefs_url style = default_style
  mogilefs = MogileFSConnect.connect_tracker
  url = original_filename.nil? ? interpolate(@default_url, style) : interpolate(@url, style)
  mogilefs.get_paths(url)[0]
  rescue MogileFS::Backend::UnknownKeyError
    Paperclip.logger.error("[paperclip] Error: #{url} not found in MogileFS")
end