在我的小型 Rails 应用程序中,我有一个名为 say 的控制器,里面有两页 hello 和 goodbye。我在应用程序中安装了设计。最初,我能够以 /users/sign_in 的身份访问 sing_in 页面,并且类似地进行注册。我无法退出,由于无法退出,我无法再次访问注册或登录页面。现在我在 eh say/hello 页面中输入了以下代码
<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 页面。
我在做什么错?我应该如何注销?
我也试过
destroy_user_session_path, :method => :delete