Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined method `fog_host='

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

config/initializers/carrierwave.rb:4: undefined method `fog_host=' for CarrierWave::Uploader::Base:Class (NoMethodError)

Here is my initializers/carrierwave.rb file:

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

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

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

like image 276
mbajur Avatar asked Oct 24 '12 00:10

mbajur


1 Answers

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

Update:

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

like image 134
Peter Brown Avatar answered Sep 29 '22 15:09

Peter Brown