Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.83 KB  |  hits: 50  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. AWS::S3::S3Object.url_for - How to do this with the new AWS SDK Gem?
  2. def authenticated_url(style = nil, expires_in = 90.minutes)
  3.       AWS::S3::S3Object.url_for(attachment.path(style || attachment.default_style), attachment.bucket_name, :expires_in => expires_in, :use_ssl => true)
  4.   end
  5.        
  6. undefined method `url_for' for AWS::S3:Class
  7.        
  8. def authenticated_url(style = nil, expires_in = 90.minutes)
  9.   attachment.s3_object(style).url_for(:read, :secure => true, :expires => expires_in).to_s
  10. end
  11.        
  12. bucket = AWS::S3::Bucket.new(attachment.bucket_name)
  13. s3object = AWS::S3::S3Object.new(bucket, attachment.path(style || attachment.default_style))
  14. s3object.url_for(:read, :expires => expires_in)
  15.        
  16. def authenticated_url(style = nil, expires_in = 90.minutes)
  17.    self.attachment.expiring_url(expires_in, (style || attachment.default_style))
  18.  end