Extension for Paperclip environment aware attachments (ie. different storages or config for differents environments)
Pull request Compare This branch is 3 commits behind jbarreneche:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
MIT-LICENSE
README.textile
Rakefile
paperclip-env_aware.gemspec

README.textile

Paperclip Environment Aware

This gem allows you to easily configure different stores in the different Rails environments for paperclip attachments. This is useful, for example, when you want to use S3 in production but not in development mode. You should be able to configure paperclip to use the file system storage in development and S3 in production. Also it’s usefull to have different buckets or paths for each environment.

Quick Start

Create config/paperclip_env.yml with your configurations (similar to database.yml)
Ej.

  # config/paperclip_env.yml
  ---
  production:
    storage: :s3
    s3_credentials:
      access_key_id: ASI3p24809we8409
      secret_access_key: V3Cxnx23yKuViGEzQPqrVVRwhUzSmTpD+wN/M0WL
    path: ":attachment/:id/:style/:basename.:extension"
    bucket: some_bucket
  class SomeModel < ActiveRecord::Base
    has_attached_file :main_photo
  end

With this configuration your non-production environments will store in your file system and your production environment will store in S3

TODO

Currently it’s not very flexible, but I’ll work to allow different configurations for differents models.