Module: Challah::UserFindable::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#activeObject



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

def active
  where(active: true)
end

#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



16
17
18
19
20
21
# File 'lib/challah/concerns/user/findable.rb', line 16

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

#inactiveObject



23
24
25
# File 'lib/challah/concerns/user/findable.rb', line 23

def inactive
  where.not(active: true)
end