使用资产管道Rails 3.2时从公用文件夹提供图像 [英] Serving images from public folder when using asset pipeline Rails 3.2
问题描述
我正在使用Rails 3.2资产管道来提供资产(图片,javascript.css).
I am using Rails 3.2 asset pipeline to serve my assets(images, javascript. css).
我添加了回形针来上传照片.默认情况下,回形针将文件存储在public/system
I have added paperclip for photo uploads. paperclip by default stores files in public/system
当我使用回形针生成的url
时,就像
When I use the url
generated by paperclip which is something like
/system/users/avatar/000/000/thumb/whatever.jpg
它没有路由错误.该文件位于上面的位置,但我认为可能是资产pipleline出现了问题.
It gives me no route error. the file is there at the above location but I think it may be issue with asset pipleline.
任何想法可能出什么问题吗?
Any ideas what might be going wrong ?
推荐答案
就像user451893所说的那样.您应该配置您的网络服务器(nginx,apache等)以交付所有静态资产!
just like user451893 said. you should configure your web-server (nginx, apache etc) to deliver all static assets!
如果不这样做,则需要打开Rails中的静态资产服务:
in case you don't, then you need to turn on static asset serving in rails:
config.serve_static_assets = true
请查看此问题以获取更多详细信息 https://github.com/thoughtbot/paperclip/issues/667
have a look at this issue for more details https://github.com/thoughtbot/paperclip/issues/667
这篇关于使用资产管道Rails 3.2时从公用文件夹提供图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!