Skip to content

Instantly share code, notes, and snippets.

@georgebrock
Forked from tomlea/s3secure.rb
Created January 20, 2010 22:22
Show Gist options
  • Save georgebrock/282352 to your computer and use it in GitHub Desktop.
Save georgebrock/282352 to your computer and use it in GitHub Desktop.
# A secure S3 storage engine for Paperclip.
# Usage:
#
# require "paperclip/storage/s3secure"
# has_attached_file :image, :storage => :S3secure, :s3_permissions => :private, …
module Paperclip::Storage::S3secure
def self.extended base
base.extend(Paperclip::Storage::S3)
end
def url(style = default_style, include_updated_timestamp = false)
s3_options = {:expires_in => 10.minutes}
AWS::S3::S3Object.url_for path(style), bucket_name, s3_options
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment