简体   繁体   English

Rails得到ActionController :: RoutingError(没有路由匹配[GET]“/assets/images/ui-bg_flat_75_ffffff_40x100.png”)

[英]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

Bug report 错误报告

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.

相关问题 ActionController::RoutingError(没有路由匹配 [GET] “/assets/images/logo.png”): - ActionController::RoutingError (No route matches [GET] “/assets/images/logo.png”): ActionController :: RoutingError(没有路由匹配[GET]“/assets/images/control_top.png”):在rails 3.2.8中 - ActionController::RoutingError (No route matches [GET] “/assets/images/control_top.png”): in rails 3.2.8 ActionController :: RoutingError(没有路由与[GET]“ / assets / images匹配 - ActionController::RoutingError (No route matches [GET] "/assets/images rails 3.1 ActionController :: RoutingError(没有路由匹配[GET]“/assets/rails.png”): - rails 3.1 ActionController::RoutingError (No route matches [GET] “/assets/rails.png”): ActionController :: RoutingError(没有路线与[GET]“ / assets / star-off.png”匹配):在rails4中,heroku - ActionController::RoutingError (No route matches [GET] “/assets/star-off.png”): in rails4 , heroku ActionController :: RoutingError(没有路线与[GET]“ / images / medium / missing.png”匹配): - ActionController::RoutingError (No route matches [GET] “/images/medium/missing.png”): Rails-ActionController :: RoutingError(没有路线与[GET]“ /generic.png”匹配): - Rails - ActionController::RoutingError (No route matches [GET] “/generic.png”): ActionController :: RoutingError(没有路由与[GET]匹配” / assets / javascripts - ActionController::RoutingError (No route matches [GET] "/assets/javascripts 本地主机-ActionController :: RoutingError(没有路由与[GET]“ / images / medium / missing.png”匹配): - local host - ActionController::RoutingError (No route matches [GET] “/images/medium/missing.png”): ActionController :: RoutingError(没有路由与[GET]匹配 - ActionController::RoutingError (No route matches [GET] "
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM