Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Spree extension for using carrierwave/fog over paperclip.

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

Spree Carrierwave

This is a Spree extension that uploads images to Amazon S3 via CarrierWave instead of the default Paperclip.

Why?

The Paperclip gem uses the aws-s3 gem, which causes problems when used with Spree:

superclass mismatch for class PriceBucket (TypeError)

Some have claimed to have gotten around this, but the solutions given haven't worked for me.

Installation

Add spree_carrierwave to your Gemfile and bundle.

Configuration

Create an initializer for CarrierWave (config/initializers/spree_carrierwave.rb):

# See the section titled 'Using Amazon S3' at https://github.com/jnicklas/carrierwave
# for full options.

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => 'AWS',
    :aws_access_key_id      => ENV['AWS_ACCESS_KEY_ID'],
    :aws_secret_access_key  => ENV['AWS_SECRET_ACCESS_KEY']
  }
  config.fog_directory  = 'my-bucket'
  config.fog_attributes = { 'Cache-Control'=>'max-age=315576000' }
end

Enjoy!

Copyright (c) 2012 Genuity Technology Services, released under the New BSD License

Something went wrong with that request. Please try again.