Skip to content

Commit

Permalink
fix regression
Browse files Browse the repository at this point in the history
mongoid raises NotFoundException when row could not be found
  • Loading branch information
ckruse committed Jul 22, 2012
1 parent 3332795 commit 2586272
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/sorcery/controller.rb
Expand Up @@ -111,6 +111,9 @@ def login_from_other_sources

def login_from_session
@current_user = (user_class.find(session[:user_id]) if session[:user_id]) || false
rescue => exception
return false if defined?(Mongoid) and exception.is_a?(Mongoid::Errors::DocumentNotFound)
raise exception
end

def after_login!(user, credentials = [])
Expand Down

0 comments on commit 2586272

Please sign in to comment.