Ruby on rails 轨道路由错误

Ruby on rails 轨道路由错误,ruby-on-rails,railstutorial.org,Ruby On Rails,Railstutorial.org,我跟随迈克尔·哈特尔的脚步,已经到达了本书的签到/注销部分 到目前为止,我可以创建一个新用户(或者我的房东)并使用新凭据登录。我遇到的问题是何时注销。我单击“注销”,得到一个路由错误,上面写着: 没有与[GET]“/signout”匹配的路由 下面是代码片段。任何帮助都将不胜感激 耙路输出 landlords GET /landlords(.:format) landlords#index POST /landlords(.:forma

我跟随迈克尔·哈特尔的脚步,已经到达了本书的签到/注销部分

到目前为止,我可以创建一个新用户(或者我的房东)并使用新凭据登录。我遇到的问题是何时注销。我单击“注销”,得到一个路由错误,上面写着:

没有与[GET]“/signout”匹配的路由

下面是代码片段。任何帮助都将不胜感激

耙路输出

landlords GET    /landlords(.:format)           landlords#index
               POST   /landlords(.:format)           landlords#create
  new_landlord GET    /landlords/new(.:format)       landlords#new
 edit_landlord GET    /landlords/:id/edit(.:format)  landlords#edit
      landlord GET    /landlords/:id(.:format)       landlords#show
               PUT    /landlords/:id(.:format)       landlords#update
               DELETE /landlords/:id(.:format)       landlords#destroy
    properties GET    /properties(.:format)          properties#index
               POST   /properties(.:format)          properties#create
  new_property GET    /properties/new(.:format)      properties#new
 edit_property GET    /properties/:id/edit(.:format) properties#edit
      property GET    /properties/:id(.:format)      properties#show
               PUT    /properties/:id(.:format)      properties#update
               DELETE /properties/:id(.:format)      properties#destroy
      sessions POST   /sessions(.:format)            sessions#create
   new_session GET    /sessions/new(.:format)        sessions#new
       session DELETE /sessions/:id(.:format)        sessions#destroy
          root        /                              content_pages#home
content_pages_home GET    /content_pages/home(.:format)  content_pages#home
          help        /help(.:format)                content_pages#help
     questions        /questions(.:format)           content_pages#questions
        signup        /signup(.:format)              landlords#new
        signin        /signin(.:format)              sessions#new
       signout DELETE /signout(.:format)             sessions#destroy
routes.rb文件

  resources :landlords
  resources :properties
  resources :sessions, only: [:new, :create, :destroy]

  root :to => 'content_pages#home'

  get "content_pages/home"

  match '/help', to: 'content_pages#help'
  match '/questions', to: 'content_pages#questions'
  match '/signup', to: 'landlords#new'
  match '/signin', to: 'sessions#new'
  match '/signout', to: 'sessions#destroy', via: :delete
链接到注销

<%= link_to "Signout", signout_path, method: "delete" %>

以下代码中的
via:
选项将请求限制为删除方法:

match '/signout', to: 'sessions#destroy', via: :delete
您需要制作一个与“get”方法一起工作的


查看以下代码中的
via:
选项将请求限制为删除方法:

match '/signout', to: 'sessions#destroy', via: :delete
您需要制作一个与“get”方法一起工作的


查看

会话助手中是否有
注销
方法?请参阅书籍/网站中的清单8.30。控制器的
destroy
方法正在寻找它。是的,我在会话助手“def sign\u self.current\u london=nil cookies.delete(:memory\u token)end'Hey@TonyStaunton”中有一个注销方法。答案对你有用吗?我仍然有相同的问题。您在会话帮助程序中是否有
注销
方法?请参阅书籍/网站中的清单8.30。控制器的
destroy
方法正在寻找它。是的,我在会话助手“def sign\u self.current\u london=nil cookies.delete(:memory\u token)end'Hey@TonyStaunton”中有一个注销方法。答案对你有用吗?我仍然有同样的问题。