Module: Challah::AuthableUser::ClassMethods
- Defined in:
- lib/challah/authable/user.rb
Instance Method Summary (collapse)
-
- (Object) find_for_session(username_or_email)
Find a user instance by username first, or email address if needed.
- - (Object) protect_attributes(*args)
Instance Method Details
- (Object) find_for_session(username_or_email)
Find a user instance by username first, or email address if needed. If no user is found matching, return nil
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/challah/authable/user.rb', line 35 def find_for_session(username_or_email) return nil if username_or_email.to_s.blank? result = nil result = find_by_username(username_or_email) unless result if username_or_email.to_s.include?('@') result = find_by_email(username_or_email) end end result end |
- (Object) protect_attributes(*args)
51 52 53 54 |
# File 'lib/challah/authable/user.rb', line 51 def protect_attributes(*args) self.protected_attributes ||= [] self.protected_attributes << args.collect(&:to_s) end |