I'm using Carrierwave 0.5.3 and Fog to upload images to Amazon-S3.
The setup works smoothly when running locally, no errors.
But when running on Heroku, uploads fail with this message:
2011-03-31T12:53:46-07:00 app[web.1]: ArgumentError ( is not a recognized storage provider):
2011-03-31T12:53:46-07:00 app[web.1]: app/controllers/useditems_controller.rb:36:in `create'
I've got an initializer:
# /config/initializers/fog.rb
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => 'secret',
:aws_secret_access_key => 'also secret',
:region => 'eu-west-1'
}
config.fog_directory = 'jabberwocky'
end
And an uploader:
# /app/uploaders/image_uploader.rb
# encoding: utf-8
class ImageUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
include CarrierWave::RMagick
# Choose what kind of storage to use for this uploader:
storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"useditems"
end
def cache_dir
"#{Rails.root}/tmp/uploads"
end
# Create different versions of your uploaded files:
version :thumb do
process :resize_to_limit => [220, 2000]
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(jpg jpeg gif png)
end
end
I've traced the error message to Fog, and it seems that Fog, under Heroku, isn't getting the config info from the initializer. :provider
is somehow empty. But I'm stumped as to how to fix it.
Any help would be much appreciated.
I'm using:
rails 3.0.4
heroku 1.19.1
fog 0.7.1
ruby 1.9.2 under rvm