Complete Lesson 32
This commit is contained in:
parent
8f470ae322
commit
2f332557ee
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -17,6 +17,11 @@
|
||||
<li class="nav-item">
|
||||
<%= link_to current_user.name, current_user %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "Sign Out", session_path,
|
||||
data: { turbo_method: :delete },
|
||||
class: "button" %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="nav-item">
|
||||
<%= link_to "Sign In", new_session_path, class: "nav-link" %>
|
||||
|
Loading…
x
Reference in New Issue
Block a user