使用资产管道Rails 3.2时从公用文件夹提供图像

编程入门 行业动态 更新时间:2024-10-28 00:16:48
本文介绍了使用资产管道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

请查看此问题以获取更多详细信息 github/thoughtbot/paperclip/issues/667

have a look at this issue for more details github/thoughtbot/paperclip/issues/667

更多推荐

使用资产管道Rails 3.2时从公用文件夹提供图像

本文发布于:2023-07-12 07:25:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1096850.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   管道   图像   资产   Rails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!