Giter Site home page Giter Site logo

paperclip-s3's Introduction

Paperclip S3 Storage

This gem will force paperclip to store attachments on S3 if your application is in production. It’s great for Heroku apps.

Important Notes

If you’re in fact using Heroku, and you want the attachments to have custom paths. PLEASE do not use RAILS_ROOT. Why? Every time you deploy your app to Heroku, you’re changing the RAILS_ROOT, so all your uploaded files will be lost and your bucket WILL be a mess!

A default, Heroku-working path is on by default, so you can just use it.

How to Use

This gem will read your S3 credentials from the server’s environment. You will need to provide a secret key, an access key and a bucket. (You can provide an s3_credentials hash options with access_key_id and secret_access_key instead.)

If you are using Heroku, it’s really easy to do this, just

  heroku config:add S3_BUCKET=your_bucket_name
  heroku config:add S3_KEY=your_access_key
  heroku config:add S3_SECRET=your_secret_key

Ok, if you’re really lazy, you can do that in one line:

  heroku config:add S3_BUCKET=your_bucket_name S3_KEY=your_access_key S3_SECRET=your_secret_key

After you’ve done this, you can use paperclip normally. The gem just extends this methods and changes the options to force the S3 Storage. You can even use the same options (like path, default_style, etc.)

Contribute

Feel free to fork, fix/patch/extend this. Everything is welcome.

TODO

  • Clean the Railtie, specially the Rails.env part.

paperclip-s3's People

Contributors

davidmfoley avatar maxjustus avatar nhocki avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.