Carrierwave and s3 with heroku error undefined method `fog_credentials='

[亡魂溺海] 提交于 2020-01-01 14:23:14

问题


I'm trying to setup carrierwave and s3 with heroku. I'm following the carrierwave docs exactly: https://github.com/jnicklas/carrierwave

I've setup a bucket named testbucket in AWS, then I installed fog and created a new initializer with this inside :

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => 'AWS',       # required
    :aws_access_key_id      => 'my_key_inside_here',       # required
    :aws_secret_access_key  => 'my_secret_access_key_here',       # required
    :region                 => 'eu-west-1'  # optional, defaults to 'us-east-1'
  }
  config.fog_directory  = 'testbucket'                     # required

end

Then inside my image_uploader.rb I set

 storage :fog

Is there something else I am missing??? Thanks for any help.


回答1:


If you're using carrier-wave 0.5.2, you have to look in the docs within the gem. They are different than what you see on github. Specifically, check out this file in the gem: lib/carrierwave/storage/s3.rb

Also set store to :s3...not :fog. You'll see this section:

#     CarrierWave.configure do |config|
#       config.s3_access_key_id = "xxxxxx"
#       config.s3_secret_access_key = "xxxxxx"
#       config.s3_bucket = "my_bucket_name"
#     end
#


来源:https://stackoverflow.com/questions/5481523/carrierwave-and-s3-with-heroku-error-undefined-method-fog-credentials

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!