Fix exception on missing user

This commit is contained in:
Ari Timonen 2020-04-14 01:24:50 +03:00
parent 3b616698a6
commit 3dc2de0fd6

View file

@ -9,12 +9,13 @@ class ApplicationController < ActionController::Base
# Omniauth has its own CSRF
protect_from_forgery :except => [:callback]
respond_to :html, :js
def cuser
begin
@cuser ||= User.find(session[:user])
# Don't error if the user is missing.
rescue
session[:user] = nil
@cuser = nil