[英]Rails getting ActionController::RoutingError (No route matches [GET] “/assets/images/ui-bg_flat_75_ffffff_40x100.png”)
I'm getting the following error in a Rails app (doing a GET request for an image that doesn't exist:): 我在Rails应用程序中遇到以下错误(对不存在的图像执行GET请求:):
ActionController::RoutingError (No route matches [GET] "/assets/images/ui-bg_flat_75_ffffff_40x100.png"):
actionpack (3.2.12) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.12) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
...
It looks like a known error in jquery-ui.css 它看起来像jquery-ui.css中的已知错误
These sites talk about it: 这些网站谈论它:
jquery-ui.css images jquery-ui.css图片
Fixed jQuery UI CSS and image location to work with minified assets 修复了jQuery UI CSS和图像位置以使用缩小的资产
And 和
I have jquery-ui.css in my stylesheets folder. 我的stylesheets文件夹中有jquery-ui.css。 It is this version: /*!
这个版本是:/ *! jQuery UI - v1.9.2 - 2012-11-23
jQuery UI - v1.9.2 - 2012-11-23
Line 246 has: 246行有:
url(images/ui-bg_flat_75_ffffff_40x100.png)
But, I don't know how to fix it. 但是,我不知道如何解决它。
Any help would be appreciated! 任何帮助,将不胜感激!
Rather than modifying the hardcoded url path, you'd be better looking at The Asset Pipeline Rails Guide (css and sass) and using one of the listed asset pipeline helpers. 您不必修改硬编码的URL路径,而是更好地查看“资产管道导轨指南”(css和sass)并使用其中一个列出的资产管道帮助程序。
That way, using the image-path("asset.png")
syntax, your referenced asset will always be correct. 这样,使用
image-path("asset.png")
语法,您引用的资产将始终是正确的。
I believe you can resolve this by viewing your jquery-ui.css
and/or jquery-ui.theme.css
and finding the line that is pointing to and removing images
at the start so therefore it would look like this. 我相信您可以通过查看
jquery-ui.css
和/或jquery-ui.theme.css
并找到指向并在开始时删除images
的行来解决此问题,因此它看起来像这样。
url(ui-bg_flat_75_ffffff_40x100.png)
instead of: 代替:
url(images/ui-bg_flat_75_ffffff_40x100.png)
Its looking at the wrong path therefore you will receive this error. 因此,它会查看错误的路径,您将收到此错误。
你能不能只改变图像的路径,或者确保它出现在你的/ public / assets / images目录中?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.