我确信我只是通过发布这个问题来增加现有的路由错误问题,但如果我在过去几天没有处理这个问题而没有成功,我就不会发布这个问题。我目前正在经历组合两个rails应用程序的过程,到目前为止,有些事情是有效的,有些事情则没有。目前,我正在努力让应用程序B的路由在应用程序A中运行。它们都在使用rails 3运行,并且两者都可以作为独立应用程序运行。我想如果我只是简单地将应用程序B中的路由复制并粘贴到应用程序A中,一切都会很好地工作,但事实并非如此。
截至目前,这是我的Routes.rb文件,我正在尝试使用以下网址http://localhost:3000/forums/显示论坛控制器的索引页:
ProTemplateApp31::Application.routes.draw do
resources :topics do
member do
get 'show_new'
end
end
resources :forums
resources :posts
resources :blog_entries
resources :category
match "login" => 'forums/index'
devise_for :users
root :to => "home#index"
end
产生此错误消息:
路由错误
没有路线匹配{:action =>“show”,:controller =>“forums”}
执行rake路线后,这是我的路线文件:
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 :(得分:0)
我在我试图访问的索引页面上有一个指向我的论坛的show动作的链接。链接没有使用正确的href url,因此从我的rake路由中显示的内容中抽象出来。我只需要用forum_path(forum_object)