diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 4f4f003..6d0a052 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -14,5 +14,7 @@ class SessionsController < ApplicationController end def destroy + session[:user_id] = nil + redirect_to movies_url, status: :see_other, notice: "You're now signed out!" end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b107d28..a73b63b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -31,6 +31,7 @@ class UsersController < ApplicationController def destroy set_user @user.destroy + session[:user_id] = nil redirect_to movies_url, status: :see_other, alert: "Account successfully deleted!" end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index f6bdbcb..a9b26f4 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -17,6 +17,11 @@