0
Rails新手問題,我似乎無法弄清楚。在某些時候,我設法在我的應用程序全站範圍內從我的一個資源中斷開路由。我得到了我的網站上的每一頁下面:Rails 3的路由問題
Routing Error No route matches {:action=>"show", :controller=>"assets", :ext=>"css", :body=>true, :digest=>false, :id=>#}
如果我刪除<%= stylesheet_link_tag「應用程序」%>和<%= javascript_include_tag「應用程序」%>一切正常。
我在route.rb文件中的以下內容:
resources :security_prices resources :securities resources :assets resources :portfolios do resources :accounts end
,但是當我做了
rake routes
我得到:
security_prices GET /security_prices(.:format) {:action=>"index", :controller=>"security_prices"} POST /security_prices(.:format) {:action=>"create", :controller=>"security_prices"} new_security_price GET /security_prices/new(.:format) {:action=>"new", :controller=>"security_prices"} edit_security_price GET /security_prices/:id/edit(.:format) {:action=>"edit", :controller=>"security_prices"} security_price GET /security_prices/:id(.:format) {:action=>"show", :controller=>"security_prices"} PUT /security_prices/:id(.:format) {:action=>"update", :controller=>"security_prices"} DELETE /security_prices/:id(.:format) {:action=>"destroy", :controller=>"security_prices"} securities GET /securities(.:format) {:action=>"index", :controller=>"securities"} POST /securities(.:format) {:action=>"create", :controller=>"securities"} new_security GET /securities/new(.:format) {:action=>"new", :controller=>"securities"} edit_security GET /securities/:id/edit(.:format) {:action=>"edit", :controller=>"securities"} security GET /securities/:id(.:format) {:action=>"show", :controller=>"securities"} PUT /securities/:id(.:format) {:action=>"update", :controller=>"securities"} DELETE /securities/:id(.:format) {:action=>"destroy", :controller=>"securities"} portfolio_accounts GET /portfolios/:portfolio_id/accounts(.:format) {:action=>"index", :controller=>"accounts"} POST /portfolios/:portfolio_id/accounts(.:format) {:action=>"create", :controller=>"accounts"} new_portfolio_account GET /portfolios/:portfolio_id/accounts/new(.:format) {:action=>"new", :controller=>"accounts"} edit_portfolio_account GET /portfolios/:portfolio_id/accounts/:id/edit(.:format) {:action=>"edit", :controller=>"accounts"} portfolio_account GET /portfolios/:portfolio_id/accounts/:id(.:format) {:action=>"show", :controller=>"accounts"} PUT /portfolios/:portfolio_id/accounts/:id(.:format) {:action=>"update", :controller=>"accounts"} DELETE /portfolios/:portfolio_id/accounts/:id(.:format) {:action=>"destroy", :controller=>"accounts"} portfolios GET /portfolios(.:format) {:action=>"index", :controller=>"portfolios"} POST /portfolios(.:format) {:action=>"create", :controller=>"portfolios"} new_portfolio GET /portfolios/new(.:format) {:action=>"new", :controller=>"portfolios"} edit_portfolio GET /portfolios/:id/edit(.:format) {:action=>"edit", :controller=>"portfolios"} portfolio GET /portfolios/:id(.:format) {:action=>"show", :controller=>"portfolios"} PUT /portfolios/:id(.:format) {:action=>"update", :controller=>"portfolios"} DELETE /portfolios/:id(.:format) {:action=>"destroy", :controller=>"portfolios"} home_index GET /home/index(.:format) {:controller=>"home", :action=>"index"} root / {:controller=>"home", :action=>"index"}
這顯然不具備這樣的資產我懷疑我是在flu something什麼東西。我如何去調試呢?
如果您的資產是CSS和JS,他們的位置是在公開場合,並且他們不需要路線。 – Syl
aaah,所以「資產」是欄杆中的保留字,我應該選擇另一個名稱? – outside2344
是的,這是用於處理javascript,樣式表和圖像的「資產管道」。更多這裏:http://guides.rubyonrails.org/asset_pipeline.html – davidb