How to devise destroy session and sign out from controller?

前端 未结 4 824
时光取名叫无心
时光取名叫无心 2021-02-13 02:13

Devise destroy session and sign out from controller?

if something_is_not_kosher
  # 1. log this event, 2. send notice
  redirect_to destroy_user_session_path and         


        
4条回答
  •  既然无缘
    2021-02-13 02:26

    Just in case someone can't use it directly.

            <% if user_signed_in? %>
            
  • <%= link_to "Logout", destroy_user_session_path, :method => :delete %>
  • <% else %>
  • <%= link_to "Sign up now!", new_user_registration_path%>
  • <% end %>

提交回复
热议问题