i'm using Carrierwave with mongoid support
gem "carrierwave-mongoid", :git => "git://github.com/jnicklas/carrierwave-mongoid.git", :branch => "mongoid-3.0",:require => 'carrierwave/mongoid'
I config carrierwave to use Fog storage with AWS (S3)
# config/initializers/carrierwave.rb
CarrierWave.configure do |config|
config.storage = :fog
config.root = Rails.root.join('tmp') # adding these...
config.cache_dir = 'carrierwave' # ...two lines
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => '',
:aws_secret_access_key => ''
},
config.fog_directory = 'alzheimer'
end
I have a class called Picture to use with the Uploader and the uploader
class ImagenUploader < CarrierWave::Uploader::Base
include CarrierWave::MimeTypes
include CarrierWave::RMagick
storage :fog
process :set_content_type
process :convert => 'png'
def filename
super.chomp(File.extname(super))+'.png'
end
version :thumb do
process :resize_to_fit => [24,24]
end
end
And my Picture Model class Picture include Mongoid::Document include Mongoid::Timestamps include Mongoid::Paranoia belongs_to :user
field :descripcion, :type => String
field :titulo, :type => String
field :imagen, :type => String
attr_accessible :imagen, :imagen_cache, :descripcion, :titulo
mount_uploader :imagen, ImagenUploader
end
I try to upload an image, ad i get:
ArgumentError: is not a recognized storage provider
from /Users/msdark/.rvm/gems/ruby-1.9.3-p194/gems/fog-1.5.0/lib/fog/storage.rb:33:in new'
from /Users/msdark/.rvm/gems/ruby-1.9.3-p194/gems/carrierwave-0.6.2/lib/carrierwave/storage/fog.rb:106:inconnection'
I use rails 3.2.8 ruby 1.9.3p194 and unicorn (4.3.1)
The error shows up after upload when try to show this:
image_tag(picture.imagen_url)
Any idea?
EDITED:
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.8'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'therubyracer', :platform => :ruby
gem 'uglifier', '>= 1.0.3'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'less-rails-bootstrap'
end
gem 'unicorn'
gem 'heroku'
gem 'foreman'
gem 'i18n'
gem 'formtastic'
gem "activeadmin-mongoid", git: "git://github.com/elia/activeadmin-mongoid.git"
gem 'mongoid'
gem 'bson_ext'
gem 'devise'
gem 'devise-i18n'
gem 'omniauth'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem "carrierwave-mongoid", :git => "git://github.com/jnicklas/carrierwave-mongoid.git", :branch => "mongoid-3.0", :require => 'carrierwave/mongoid'
gem 'mini_magick', :git => 'git://github.com/probablycorey/mini_magick.git'
gem 'recaptcha', :require => 'recaptcha/rails'
gem 'googlecharts'
group :test do
gem 'capybara'
gem 'database_cleaner'
gem 'mongoid-rspec'
gem 'launchy'
gem 'factory_girl_rails'
gem 'mongoid-rspec'
gem 'faker'
end
gem 'rspec-rails',:group =>[:development,:test]