在我的小rails应用程序中,我有一个名为say的控制器,里面有两个页面: hello和再见。我在应用程序中安装了devise。最初,我能够以/users/ sing_in _in和类似的方式访问用户页面进行注册。我无法注销,并且由于无法注销,我无法再次访问注册或登录页面。现在我输入了下面的代码
<h1>Say#hello</h1>
<% if user_signed_in? %>
Hey signed in as <%= current_user.email %>.Not you?
<%= link_to "Logout", destroy_user_session_path %>
<% else %>
Hey <%= link_to "Login", new_user_session_path %> or Hey <%= link_to "Logup", new_user_registration_path %>
<% end %>
</p>这是应用程序的路由页面。
Demo::Application.routes.draw do
devise_for :users
get "say/hello"
get "say/goodbye"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root :to => "say#hello"
end每当我访问say/hello页面时,我都会得到以下输出
Links
Hey signed in as x@gmail.com.Not you? Logout 当我单击注销时。上面写着
No route matches [GET] "/users/sign_out"当我直接访问users/sign_in时,我会被路由到say/hello页面。
我到底做错了什么?我应该如何sign_out?
我也试过
destroy_user_session_path, :method => :delete发布于 2013-07-03 15:15:49
希望这能有所帮助
在你的routes.rb中试试这个
devise_for :用户得到'/users/sign_out‘=> 'devise/sessions#destroy’结束
https://stackoverflow.com/questions/17440606
复制相似问题