2013-05-09 42 views
5

我在Rails應用程序中收到以下錯誤(對圖像執行GET請求「T存在:):獲取ActionController :: RoutingError的Rails(沒有路由匹配[GET]「/assets/images/ui-bg_flat_75_ffffff_40x100.png」)

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已知錯誤

這些網站談論它:

jquery-ui.css images

Fixed jQuery UI CSS and image location to work with minified assets

而且

Bug report

我在我的樣式表文件夾jQuery的ui.css。它是這個版本:/ *! jQuery UI的 - v1.9.2的 - 2012年11月23日

線246具有:

url(images/ui-bg_flat_75_ffffff_40x100.png) 

但是,我不知道如何解決它。

任何幫助,將不勝感激!

回答

6

我相信您可以通過查看您的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) 

它看在錯誤的道路因此,你將收到此錯誤。

+0

感謝您的幫助! – Reddirt 2013-05-09 14:20:59

0

難道你不只是改變圖像的路徑,或確保它存在於你的/ public/assets/images目錄中嗎?

7

而不是修改硬編碼的url路徑,您最好查看The Asset Pipeline Rails Guide (css and sass)並使用其中一個列出的資產管道助手。

這樣,使用image-path("asset.png")語法,您引用的資產將永遠是正確的。

+0

這對我有效,但也必須將文件名從.css更改爲.css.scss – Elliott 2013-11-12 19:23:52

相關問題