Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Paperclip-multiple-s3-accounts
==============================

PaperclipMultipleS3Accounts extends Paperclip (https://github.com/thoughtbot/paperclip). It adds functionality to pass the s3_credentials for has_attached_file as a Proc. This allows the use of for multiple S3 accounts per object in a single application.


Example
=======

In your model:

  class User < ActiveRecord::Base
    belongs_to :s3bucket
    
    has_attached_file :photo,
                      :storage => :s3,
                      :s3_permissions => "public-read",
                      :path => "/:attachment/:id/:basename.:extension",
                      :s3_credentials => (lambda do |attachment|
                            h = {
                              'bucket'            => attachment.instance.s3bucket.name,
                              'access_key_id'     => attachment.instance.s3bucket.access_key_id,
                              'secret_access_key' => attachment.instance.s3bucket.secret_access_key
                            }
                          end)


Copyright (c) 2011 Lukas Eklund, released under the MIT license

About

Paperclip extension to allow for multiple Amazon S3 accounts

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages