Skip to content

Commit

Permalink
There's no reason to query the db with NULLs
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Bleigh <michael@intridea.com>
  • Loading branch information
TomK32 authored and Michael Bleigh committed Apr 28, 2009
1 parent a545b5f commit f5c1d1d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/twitter_auth/controller_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f5c1d1d

Please sign in to comment.