1

我正在做 Michael Hartl 的 Ruby on Rails 教程,但遇到路由错误。
这是执行后的终端输出rake routes

      users GET    /users(.:format)          users#index
            POST   /users(.:format)          users#create
   new_user GET    /users/new(.:format)      users#new
  edit_user GET    /users/:id/edit(.:format) users#edit
       user GET    /users/:id(.:format)      users#show
            PUT    /users/:id(.:format)      users#update
            DELETE /users/:id(.:format)      users#destroy
   sessions POST   /sessions(.:format)       sessions#create
new_session GET    /sessions/new(.:format)   sessions#new
    session DELETE /sessions/:id(.:format)   sessions#destroy
       root        /                         static_pages#home
     signup        /signup(.:format)         users#new
     signin        /signin(.:format)         sessions#new
    signout DELETE /signout(.:format)        sessions#destroy
       help        /help(.:format)           static_pages#help
      about        /about(.:format)          static_pages#about
    contact        /contact(.:format)        static_pages#contact


当 localhost:3000/signin/ 或 localhost:3000/sessions/new 时,路由错误如下

No route matches {:action=>"destroy", :controller=>"sessions"}

有人对如何更正路线设置有答案吗?

4

1 回答 1

0

你的路由文件中有这样的一行吗?

match '/signout', :to => 'sessions#destroy'

于 2013-04-12T19:30:01.697 回答