From 3dc2de0fd6d764c39952a15c2f8209ce5b4fb561 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Tue, 14 Apr 2020 01:24:50 +0300 Subject: [PATCH] Fix exception on missing user --- app/controllers/application_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 79418a1..4a05b69 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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