From 934b0551198488cf9e7f3eb3894a3375cb5ac2f3 Mon Sep 17 00:00:00 2001 From: Phil Cohen Date: Wed, 8 Jan 2014 14:30:10 -0800 Subject: [PATCH] `cookies[:uid]` may be an id that doesn't exist: * fixes #50 --- lib/thincloud/authentication/authenticatable_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/thincloud/authentication/authenticatable_controller.rb b/lib/thincloud/authentication/authenticatable_controller.rb index 43da801..86e3a1d 100644 --- a/lib/thincloud/authentication/authenticatable_controller.rb +++ b/lib/thincloud/authentication/authenticatable_controller.rb @@ -18,7 +18,7 @@ module AuthenticatableController # Returns: An instance of `User` or `nil`. def current_user return nil if cookies.signed[:uid].blank? - @current_user ||= User.find(cookies.signed[:uid]) + @current_user ||= User.where(id: cookies.signed[:uid]).first end # Protected: Determine if the current request has a logged in user.