魔法 Log_out 无效
Sorcery Log_out not working
这是我的路线-
get 'login' => 'sessions#new'
post 'login' => 'sessions#create'
delete 'logout' => 'sessions#destroy'
这是我的控制器操作-
def destroy
logout
redirect_to(login_url, notice: 'You have Succesfully Logged out.')
end
这是我的观点-
<li>
<%if current_user %>
<%= link_to logout_path, method: :delete do %>
<i class="fa fa-sign-out"></i> Log out
<%end%>
<%end%>
</li>
我遇到的问题是:每当我注销时它都会说-
No route matches [GET] "/logout".
我试过 GET
,我试过 DELETE
和 POST
,都没有用。
路线
login_path GET /login(.:format) sessions#new
POST /login(.:format) sessions#create
logout_path DELETE /logout(.:format) sessions#destroy
确保你的 app/assets/javascripts/application.js
中有这些
//= require jquery
//= require jquery_ujs
这是我的路线-
get 'login' => 'sessions#new'
post 'login' => 'sessions#create'
delete 'logout' => 'sessions#destroy'
这是我的控制器操作-
def destroy
logout
redirect_to(login_url, notice: 'You have Succesfully Logged out.')
end
这是我的观点-
<li>
<%if current_user %>
<%= link_to logout_path, method: :delete do %>
<i class="fa fa-sign-out"></i> Log out
<%end%>
<%end%>
</li>
我遇到的问题是:每当我注销时它都会说-
No route matches [GET] "/logout".
我试过 GET
,我试过 DELETE
和 POST
,都没有用。
路线
login_path GET /login(.:format) sessions#new
POST /login(.:format) sessions#create
logout_path DELETE /logout(.:format) sessions#destroy
确保你的 app/assets/javascripts/application.js
//= require jquery
//= require jquery_ujs