undefined method `fog_host='
Asked Answered
J

1

15

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

Journalese answered 24/10, 2012 at 0:51 Comment(0)
V
40

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

Vinnie answered 24/10, 2012 at 0:54 Comment(2)
StackOverFlow is a treasure. Fresh answer for new problem. Thanks @BeerlingtonNey
my god thank you for that! all the documentation i found used fog_host, i needed to set asset_host in my setup in order to turn OFF https urls of images so that they were viewable over normal http. thanks again!Dermott

© 2022 - 2024 — McMap. All rights reserved.