Ruby on Rails:设计 http://0.0.0.0:3000/users/sign_out 问题
http://0.0.0.0:3000/users/sign_in 有效,但 http://0.0.0.0:3000/users/sign_out
路由错误
No route matches "/users/sign_out"
routes.rb:
devise_for :users
resources :posts
root :to => "posts#index"
http://0.0.0.0:3000/users/sign_in works but http://0.0.0.0:3000/users/sign_out
Routing Error
No route matches "/users/sign_out"
routes.rb:
devise_for :users
resources :posts
root :to => "posts#index"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有同样的问题。这是由我从wiki复制的链接代码引起的。
它是
link_to'Logout', destroy_user_session_path, :method =>; :delete
,但 devise 设置为通过 :get 注销(initializers/devise.rb:178 中的# config.sign_out_via = :get
)。因此,要么取消注释此行并将其更改为
:delete
要么删除:method => :从您的 link_to 中删除
Had the same problem. It was caused by the link code that I copied from the wiki.
it was
link_to'Logout', destroy_user_session_path, :method => :delete
, but devise was set up to log out via :get (# config.sign_out_via = :get
in the initializers/devise.rb:178).So either uncomment this line and change it to
:delete
or remove the:method => :delete
from your link_to