Logout redirects back to root_path

This commit is contained in:
2024-08-27 16:17:01 +02:00
parent 0953d5c915
commit 8fb6c100e7

View File

@@ -22,7 +22,12 @@ class SessionsController < ApplicationController
end
def destroy
@session.destroy; redirect_to(sessions_path, notice: "That session has been logged out")
@session.destroy
if Current.session == @session
redirect_to(root_path, notice: "You are logged out")
else
redirect_to(sessions_path, notice: "That session has been logged out")
end
end
private