当我试图运行我的应用程序,我得到以下错误:
config/initializers/carrierwave.rb:4: undefined method `fog_host=’ for
CarrierWave::Uploader::Base:Class (NoMethodError)
这是我的初始化器/ carrierwave.rb文件:
CarrierWave.configure do |config| config.storage = :fog config.fog_directory = 'media.domain.pl' config.fog_host = 'http://s3-eu-west-1.amazonaws.com/media.domain.pl' config.fog_credentials = { :provider => 'AWS',:aws_access_key_id => '***',:aws_secret_access_key => '***',:region => 'eu-west-1',} end
我的宝石文件中包含载波和雾,直到最后使用捆绑更新.有什么想法我的代码可能是错的吗?我在谷歌找不到任何东西
红宝石v.1.8.7
rails v.3.2.6
雾v.1.6.0
载波v.0.7.0
解决方法
fog_host似乎不是配置选项.从
Carrier wave文档看,您可能需要asset_host:
CarrierWave.configure do |config| config.fog_credentials = { :provider => 'AWS',# required :aws_access_key_id => 'xxx',# required :aws_secret_access_key => 'yyy',# required :region => 'eu-west-1' # optional,defaults to 'us-east-1' } config.fog_directory = 'name_of_directory' # required config.fog_public = false # optional,defaults to true config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional,defaults to {} config.asset_host = 'https://assets.example.com' # optional,defaults to nil end
更新:
这是介绍这个变化的承诺:https://github.com/jnicklas/carrierwave/commit/7046c93d6b23cffef9f171a5f7f0dd14267a7057