我需要匹配導致不匹配的複雜路由,這些是我的路由文件條目。複雜的路由問題Rails 3
match 'households/:id/edit'=>'households#edit', :via=>:get, :as=>:edit_household, :id=>/\d{1,5}/
match 'households/:id' => 'households#update', :via => :put
match 'households/:id' => 'households#destroy', :via=>:delete
match 'households/:city_code-:region_code'=>'households#index', :via=>:get, :as=>:households, :city_code=>/[A-Z]{3,5}/, :region_code=>/[A-Z]{0,3}\d{0,5}/
match 'households/:city_code-:region_code-:h_uid'=>'households#show', :via=>:get, :as=>:household, :city_code=>/[A-Z]{3,5}/, :region_code=>/[A-Z]{0,3}\d{0,5}/
現在的問題是,請求
http://0.0.0.0:3000/households/9/edit
被路由到顯示控制器和誤差產生
路由錯誤
No route matches {:controller=>"households", :action=>"show", :format=>nil, :city_code=>#<Household id: 9, uid: "0004", house_no: "House No 12", street: "Street 512", address: "Lorem ipsum dolor sit amet, consectetur adipisicing...", region_id: 3, created_at: "2012-01-05 11:06:32", updated_at: "2012-01-05 11:06:32">}
任何一個可以幫助我在裏面?
您確定該網址是路由到show controller,而不是編輯頁面上的某些內容試圖(但失敗)生成鏈接到顯示頁面? – 2012-01-05 11:50:45
是的,我確定,當我在瀏覽器中輸入直接編輯網址時,它來到'沒有路由匹配錯誤',錯誤的時候你可以看到'show'動作被描述。 – 2012-01-05 11:52:57
在development.log中是否有回溯? – 2012-01-05 12:35:04