本文介绍了未定义的方法`fog_host ='的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行我的应用程序时,出现以下错误:

When i'm trying to run my application, i'm getting the following error:

此处是我的 initializers / 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

我有 Gemfile 中包含了code> carrierwave 和 fog ,并且一直工作到捆绑更新的最后一次使用。您知道我的代码有什么问题吗?我在Google中找不到任何相关信息

I have carrierwave and fog included in my Gemfile and it was working until last use of bundle update. Have you any idea what can be wrong with my code? I can't find anything about it in google

红宝石v。1.8.7

rails v。3.2.6

fog v。1.6.0

carrierwave v。0.7.0

ruby v. 1.8.7
rails v. 3.2.6
fog v. 1.6.0
carrierwave v. 0.7.0

推荐答案

fog_host 似乎不是配置选项。从文档看来,您可能需要 asset_host 代替:

fog_host doesn't appear to be a configuration option. From the Carrier wave docs it looks like you might need asset_host instead:

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

更新:

以下是引入了该更改的提交:

Here's the commit that introduced that change: https://github.com/jnicklas/carrierwave/commit/7046c93d6b23cffef9f171a5f7f0dd14267a7057

这篇关于未定义的方法`fog_host ='的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 22:06