module Challah::UserFindable::ClassMethods
Public Instance Methods
find_for_session(username_or_email)
click to toggle source
Find a user instance by username first, or email address if needed. If no user is found matching, return nil
# 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
Protected Instance Methods
find_by_email(email)
click to toggle source
# File lib/challah/concerns/user/findable.rb, line 26 def find_by_email(email) return unless email.include?('@') where(email: email).first end