Carrierwave / Fog / S3 "is not a recognized storage provider"
amazon-s3, carrierwave, ruby-on-rails
Solution
OK, I'm an idiot. :)
At some point, I don't know where, I added a fog.rb file with my CarrierWave configuration to the lib/carrierwave/storage directory. I got desperate, paid for a Railscasts subscription so I could watch episode #383 (http://railscasts.com/episodes/383-uploading-to-amazon-s3?autoplay=true) and at 3:02 I found the error of my ways. The Carrierwave configuration needed to be placed in config/initializers/carrierwave.rb.
I don't know where I got this other location but once I moved the config to the proper location, everything is good.
Problem
I have a Rails app that is using Carrierwave for file uploads. It has been working fine but I want to start using Amazon S3 for my image storage. I am getting this error: ``` ArgumentError ( is not a recognized storage provider): app/controllers/salons_controller.rb:52:in `update' ``` I have made sure I have the latest gems for Carrierwave and Fog. This is in my Gemfile: ``` gem 'carrierwave' gem 'aws-sdk' gem 'fog' ``` fog.rb looks like: ``` CarrierWave.configure do |config| config.fog_credentials = { :provider => 'AWS', :aws_access_key_id => 'MYACCESSKEY', :aws_secret_access_key => 'MYSECRETKACCESSKEY', :region => 'us-east-1' } config.fog_directory = 'andrunix' config.fog_public = true config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} ``` end The Uploader class looks like: ``` class SalonImageUploader < CarrierWave::Uploader::Base include CarrierWave::RMagick storage :fog def store_dir # "andrunix" is the bucket name on S3 "andrunix/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end end ``` If I change the storage back to 'file', it works fine. Setting storage to 'fog' generates this error.