Rails资产管道找不到某个图像 [英] Rails asset pipeline can't find one certain image

查看:80
本文介绍了Rails资产管道找不到某个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为ui-icons_ffffff_256x240.png的图像.在生产环境中,可以在public/assets/images/ui-icons_ffffff_256x240.png中找到它.

I have a certain image called ui-icons_ffffff_256x240.png. In production it can be found, among other places, in public/assets/images/ui-icons_ffffff_256x240.png.

当我尝试在生产环境中查看此图像时,出现以下错误:

When I try to view this image in production, I get the following error:

ActionController::RoutingError (No route matches [GET] "/assets/images/ui-icons_ffffff_256x240.png"):

我觉得这很奇怪,因为图像肯定存在:

I find this extremely odd since the image most certainly is there:

$ find . -name ui-icons_ffffff_256x240.png
./vendor/assets/stylesheets/jquery-ui/images/ui-icons_ffffff_256x240.png
./public/assets/jquery-ui/images/ui-icons_ffffff_256x240.png
./public/assets/images/ui-icons_ffffff_256x240.png

我的应用程序中的所有其他图像都可以正常工作,并且一直有效.不过,我最近升级了jQuery UI版本,但该特定图像不起作用. (我认为这是我实际使用的唯一jQuery UI图像.)

All the other images in my app work fine and have been forever. I recently upgraded my version of jQuery UI, though, and this one particular image doesn't want to work. (I think it's the only jQuery UI image I'm actually using.)

我在Rails 3.2.1上.可能是什么问题?

I'm on Rails 3.2.1. What could be the issue?

推荐答案

您的js插件请求包含无效资产网址的图片. 资产图片可以通过

Your js plugin requests the image with invalid asset url. The asset image can be accessed by

/assets/ui-icons_ffffff_256x240.png

但是请求的网址是

/assets/images/ui-icons_ffffff_256x240.png

因此,在您的JavaScript或样式表中,您需要手动更正资产网址.

So in your javascript or stylesheet you need to correct asset url manually.

这篇关于Rails资产管道找不到某个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆