CarrierWave 在 Rails 3.1 生产中无法渲染图片
由于某种原因,我使用 Carrierwave 上传的图片没有显示在应用程序上。仅当我尝试在生产中部署应用程序时才会发生这种情况。我将我的商店目录配置为如下所示:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
在我的 html 源文件中,我看到它正在访问来自的图像
/uploads/picture/image/1/thumb_mango.jpg
但是,我发现在生产时该图片丢失了。在开发过程中,它渲染的图片效果很好。图片存储在“公共”文件夹内。所以路径会是这样的:
/public/uploads/...
For some reason, the picture that I upload using carrierwave is not showing up on the app. This only happens when I try to deploy the app in production. I configured my store directory to be like this:
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
And in my html source file, I see that it is accessing the image from
/uploads/picture/image/1/thumb_mango.jpg
However, I see that the picture is missing when it is on PRODUCTION. In development, it is rendering the picture just fine. The picture is stored inside the 'public' folder. So the path would be like:
/public/uploads/...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论