2011-11-04 14 views
1

我敢肯定,我只是通過發佈這個添加到無數的現有路由錯誤問題,但我不會如果我在過去幾天沒有成功解決這個問題,發佈這個帖子。我目前正在經歷將兩個rails應用程序結合在一起的過程,到目前爲止有些事情是有效的,有些事情卻不行。目前我正試圖讓應用程序B的路線在應用程序A中工作。它們都運行在軌道3上,並且都可以作爲獨立應用程序正常工作。我想如果我只是簡單地將應用程序B的路線複製並粘貼到應用程序中,一切都會很好地工作,但似乎並非如此。紅寶石1.8.7/Rails 3路由:控制器#索引不斷嘗試渲染控制器#顯示

由於當前的,這是我的routes.rb文件,我試圖讓論壇控制器的索引頁使用下列URL http://localhost:3000/forums/顯示:

將會產生此錯誤信息:

路由錯誤

沒有路由匹配{:行動=> 「節目」,:控制器=> 「論壇」}

這裏是我的routes文件做一個耙路線後:

 show_new_topic GET /topics/:id/show_new(.:format) {:action=>"show_new", :controller=>"topics"} 
       topics GET /topics(.:format)    {:action=>"index", :controller=>"topics"} 
        POST /topics(.:format)    {:action=>"create", :controller=>"topics"} 
      new_topic GET /topics/new(.:format)   {:action=>"new", :controller=>"topics"} 
      edit_topic GET /topics/:id/edit(.:format)  {:action=>"edit", :controller=>"topics"} 
       topic GET /topics/:id(.:format)   {:action=>"show", :controller=>"topics"} 
        PUT /topics/:id(.:format)   {:action=>"update", :controller=>"topics"} 
        DELETE /topics/:id(.:format)   {:action=>"destroy", :controller=>"topics"} 
       forums GET /forums(.:format)    {:action=>"index", :controller=>"forums"} 
        POST /forums(.:format)    {:action=>"create", :controller=>"forums"} 
      new_forum GET /forums/new(.:format)   {:action=>"new", :controller=>"forums"} 
      edit_forum GET /forums/:id/edit(.:format)  {:action=>"edit", :controller=>"forums"} 
       forum GET /forums/:id(.:format)   {:action=>"show", :controller=>"forums"} 
        PUT /forums/:id(.:format)   {:action=>"update", :controller=>"forums"} 
        DELETE /forums/:id(.:format)   {:action=>"destroy", :controller=>"forums"} 
       posts GET /posts(.:format)     {:action=>"index", :controller=>"posts"} 
        POST /posts(.:format)     {:action=>"create", :controller=>"posts"} 
      new_post GET /posts/new(.:format)    {:action=>"new", :controller=>"posts"} 
      edit_post GET /posts/:id/edit(.:format)  {:action=>"edit", :controller=>"posts"} 
       post GET /posts/:id(.:format)    {:action=>"show", :controller=>"posts"} 
        PUT /posts/:id(.:format)    {:action=>"update", :controller=>"posts"} 
        DELETE /posts/:id(.:format)    {:action=>"destroy", :controller=>"posts"} 
     category_index GET /category(.:format)    {:action=>"index", :controller=>"category"} 
        POST /category(.:format)    {:action=>"create", :controller=>"category"} 
     new_category GET /category/new(.:format)   {:action=>"new", :controller=>"category"} 
     edit_category GET /category/:id/edit(.:format)  {:action=>"edit", :controller=>"category"} 
      category GET /category/:id(.:format)   {:action=>"show", :controller=>"category"} 
        PUT /category/:id(.:format)   {:action=>"update", :controller=>"category"} 
        DELETE /category/:id(.:format)   {:action=>"destroy", :controller=>"category"} 
    new_user_session GET /users/sign_in(.:format)   {:action=>"new", :controller=>"devise/sessions"} 
     user_session POST /users/sign_in(.:format)   {:action=>"create", :controller=>"devise/sessions"} 
destroy_user_session DELETE /users/sign_out(.:format)  {:action=>"destroy", :controller=>"devise/sessions"} 
     user_password POST /users/password(.:format)  {:action=>"create", :controller=>"devise/passwords"} 
    new_user_password GET /users/password/new(.:format) {:action=>"new", :controller=>"devise/passwords"} 
    edit_user_password GET /users/password/edit(.:format) {:action=>"edit", :controller=>"devise/passwords"} 
        PUT /users/password(.:format)  {:action=>"update", :controller=>"devise/passwords"} 
cancel_user_registration GET /users/cancel(.:format)   {:action=>"cancel", :controller=>"devise/registrations"} 
    user_registration POST /users(.:format)     {:action=>"create", :controller=>"devise/registrations"}  
new_user_registration GET /users/sign_up(.:format)   {:action=>"new", :controller=>"devise/registrations"} 
edit_user_registration GET /users/edit(.:format)   {:action=>"edit", :controller=>"devise/registrations"} 
        PUT /users(.:format)     {:action=>"update", :controller=>"devise/registrations"} 
        DELETE /users(.:format)     {:action=>"destroy", :controller=>"devise/registrations"} 
       root  /        {:controller=>"home", :action=>"index"} 

另一個要注意的是,我做實際上擁有所有必需的控制器/意見,並沒有拼寫錯誤,只要我」意識到。

有什麼想法可能會導致這些錯誤?我試過重新啓動我的服務器多次,但沒有骰子。

+0

來替換url。引用不用於大量的代碼。 – Zabba

+0

注意到,我準備好了一個屏幕截圖,但我沒有足夠的代表發佈截圖。 :/ – Noz

回答

0

我有一個鏈接到我正在嘗試訪問的索引頁上我的論壇的顯示操作。該鏈接沒有使用正確的href url,因此從我的rake路由中顯示的內容中抽象出來。我只需要用forum_path(forum_object)