From 4a015d461ab5679e8cf1e355555fd48245b4265f Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Thu, 30 Apr 2015 13:36:48 +0000 Subject: [PATCH] Prevent exception when fetching current user --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3d2d46f..beb03b7 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base end def current_user - @current_user ||= User.find(session[:user_id]) if session[:user_id] + @current_user ||= User.find_by(id: session[:user_id]) if session[:user_id] end