2014-07-09 48 views
0

嘗試配置carrierwave上傳時,出現此錯誤,它顯示configuration.rb第73行,該文件甚至不存在?或者我無法找到它。Carrierwave:`eval':不隱式將nil轉換爲String(TypeError)

/Users/spencerlong/.rvm/gems/ruby-2.0.0-p451/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:73:in `eval': no implicit conversion of nil into String (TypeError) 

carrierwave.rb

CarrierWave.configure do |config| 

    config.storage = :aws 
    config.aws_bucket = 'larfs' 
    config.aws_acl = :public_read 
    config.asset_host = '' 
    config.aws_authenticated_url_expiration = 60 * 6 * 24 * 365 

    config.aws_credentials = { 

     access_key_id: "ABCABC", 
     secret_access_key: "ABCABC" 

    } 

end 

image_uploader.rb

class ImageUploader < CarrierWave::Uploader::Base 

include CarrierWave::MiniMagick 

storage :aws 

def store_dir 
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" 
    end 

version :thumb do 
    process :resize_to_fit => [50, 50] 
    end 

def extension_white_list 
    %w(jpg jpeg gif png) 
    end 
end 

回答

0

不知道從哪裏得到這樣的配置carrierwave的信息。 Carrierwave使用fog與AWS和任何其他雲進行通信。您需要將存儲設置爲:fog而不是aws

按照這裏的文件,它應該是罰款:Using Amazin S3

0

如果你想使用這個配置格式。

你需要"carrierwave-aws"寶石

請確認該行是否包含在Gemfile中

gem 'carrierwave-aws' 
相關問題