当尝试为上传配置carrierwave时,我收到此错误,它说配置.rb第73行,文件甚至不存在?或者我无法找到它。
/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 :(得分:1)
不知道您从哪里获得有关配置载波的信息。 Carrierwave使用fog
与AWS和任何其他云进行通信。您需要将存储设置为:fog
而不是aws
。
按照此处的文档进行操作,应该没问题:Using Amazin S3
答案 1 :(得分:0)