我一直在找几个小时,但我无法解决这个问题。
一切正常,直到我不得不更新Carrierwave并使用fog-aws gem。
我在尝试上传图片时仅在生产中出现以下错误:
TypeError (no implicit conversion of String into Integer)
我的生产.rb
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws'
config.fog_credentials = {
provider: 'AWS',
aws_access_key_id: 'MYKEY',
aws_secret_access_key: 'MYKEY',
region: 'eu-west-1'
}
config.permissions = '0666'
config.fog_directory = 'sushiartist'
end
我的日志
Processing by ShopsController#update as HTML
2016-09-26T17:15:59.794750+00:00 app[web.1]: Completed 500 Internal Server Error in 11ms
2016-09-26T17:15:59.783946+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"VPi4Svgup6sRCNXa1nwZPIIPVb0TY7re9pqQVewl15k=", "shop"=>{"name"=>"Pozas", "city"=>"Bilbao", "phone"=>"94 652 13 99", "direction"=>"Licenciado Poza, 50", "cover"=>#<ActionDispatch::Http::UploadedFile:0x007fd15cb0ba00 @tempfile=#<Tempfile:/tmp/RackMultipart20160926-3-1efzhcb>, @original_filename="york (1).png", @content_type="image/png", @headers="Content-Disposition: form-data; name=\"shop[cover]\"; filename=\"york (1).png\"\r\nContent-Type: image/png\r\n">, "latitude"=>"43.2625685", "longitude"=>"-2.9425845000000663", "email"=>"", "proximamente"=>"0", "nuevo"=>"0"}, "commit"=>"Editar", "id"=>"5"}
我绝望了,这有什么帮助吗?
答案 0 :(得分:0)
config.permissions采用整数而不是字符串。改变这个:
config.permissions = '0666'
到
config.permissions = 0666
来自https://github.com/carrierwaveuploader/carrierwave
CarrierWave.configure do |config|
config.permissions = 0666
config.directory_permissions = 0777
config.storage = :file
end