[英]ActionController::RoutingError (No route matches [GET] “/assets/images/logo.png”):
[英]Rails getting ActionController::RoutingError (No route matches [GET] “/assets/images/ui-bg_flat_75_ffffff_40x100.png”)
我在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'
...
它看起來像jquery-ui.css中的已知錯誤
這些網站談論它:
和
我的stylesheets文件夾中有jquery-ui.css。 這個版本是:/ *! jQuery UI - v1.9.2 - 2012-11-23
246行有:
url(images/ui-bg_flat_75_ffffff_40x100.png)
但是,我不知道如何解決它。
任何幫助,將不勝感激!
您不必修改硬編碼的URL路徑,而是更好地查看“資產管道導軌指南”(css和sass)並使用其中一個列出的資產管道幫助程序。
這樣,使用image-path("asset.png")
語法,您引用的資產將始終是正確的。
我相信您可以通過查看jquery-ui.css
和/或jquery-ui.theme.css
並找到指向並在開始時刪除images
的行來解決此問題,因此它看起來像這樣。
url(ui-bg_flat_75_ffffff_40x100.png)
代替:
url(images/ui-bg_flat_75_ffffff_40x100.png)
因此,它會查看錯誤的路徑,您將收到此錯誤。
你能不能只改變圖像的路徑,或者確保它出現在你的/ public / assets / images目錄中?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.