-
-
Save georgebrock/282352 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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