Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6cc2651329
Fetching contributors…

Cannot retrieve contributors at this time

file 31 lines (24 sloc) 1.214 kb

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)

  # config/paperclip_env.yml
    storage: :s3
      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

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


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

Something went wrong with that request. Please try again.