Skip to content

Commit

Permalink
Added handling for situation, when we have user_id in session, but th…
Browse files Browse the repository at this point in the history
…is user is already deleted
  • Loading branch information
damisul authored and abartov committed May 30, 2024
1 parent d0506e9 commit fb09cf8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ def sanitize_heading(h)

def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
rescue ActiveRecord::RecordNotFound
# Should only happen in development environment
session.delete(:user_id)
end

def html_entities_coder
Expand Down

0 comments on commit fb09cf8

Please sign in to comment.