0

logout GET /logout(.:format) devise/sessions#destroy

这是我感兴趣的路线。

但是,当我转到 /logout 时,我收到此错误:

No route matches [DELETE] "/logout",如何将这条路线从 更改getdelete

这就是我的路线当前设置的方式:

get 'logout', to: 'devise/sessions#destroy', as: :logout

和我的链接:

<%= link_to "Sign Out", logout_path, method: :delete %>

4

1 回答 1

5

改变:

get 'logout', to: 'devise/sessions#destroy', as: :logout

至:

delete 'logout', to: 'devise/sessions#destroy', as: :logout

您可以在此页面上找到有关路由的更多信息:Routing Rails Guide

于 2013-07-16T13:59:57.847 回答