ruby on rails - Carrierwave / Fog / S3 "is not a recognized storage provider" -
i have rails app using carrierwave file uploads. has been working fine want start using amazon s3 image storage. getting error:
argumenterror ( not recognized storage provider): app/controllers/salons_controller.rb:52:in `update'
i have made sure have latest gems carrierwave , fog. in gemfile:
gem 'carrierwave' gem 'aws-sdk' gem 'fog'
fog.rb looks like:
carrierwave.configure |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" bucket name on s3 "andrunix/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end end
if change storage 'file', works fine. setting storage 'fog' generates error.
ok, i'm idiot. :)
at point, don't know where, added fog.rb file carrierwave configuration lib/carrierwave/storage directory. got desperate, paid railscasts subscription watch episode #383 (http://railscasts.com/episodes/383-uploading-to-amazon-s3?autoplay=true) , @ 3:02 found error of ways. carrierwave configuration needed placed in config/initializers/carrierwave.rb.
i don't know got other location once moved config proper location, good.
Comments
Post a Comment