Permalink
Browse files

There's no reason to query the db with NULLs

Signed-off-by: Michael Bleigh <michael@intridea.com>
  • Loading branch information...
TomK32 authored and Michael Bleigh committed Apr 28, 2009
1 parent a545b5f commit f5c1d1dae480e6ee1fb30438d994c7c487253199
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/twitter_auth/controller_extensions.rb
@@ -20,7 +20,14 @@ def authentication_succeeded(message = 'You have logged in successfully.', desti
end
def current_user
- @current_user ||= User.find_by_id(session[:user_id]) || User.from_remember_token(cookies[:remember_token])
+ @current_user =
+ if session[:user_id]
+ User.find_by_id(session[:user_id])
+ elsif cookies[:remember_token]
+ User.from_remember_token(cookies[:remember_token])
+ else
+ false
+ end
end
def current_user=(new_user)

0 comments on commit f5c1d1d

Please sign in to comment.