Module: Challah::UserFindable::ClassMethods

Defined in:
lib/challah/concerns/user/findable.rb

Instance Method Summary collapse

Instance Method Details

#find_for_session(username_or_email) ⇒ Object

Find a user instance by username first, or email address if needed. If no user is found matching, return nil



9
10
11
12
13
14
# File 'lib/challah/concerns/user/findable.rb', line 9

def find_for_session(username_or_email)
  return if username_or_email.to_s.blank?

  username_or_email = username_or_email.downcase.strip
  find_by_email(username_or_email) || find_by_authorization(username_or_email)
end