Module: Challah::UserAttributeable

Extended by:
ActiveSupport::Concern
Included in:
Userable
Defined in:
lib/challah/concerns/user/attributeable.rb

Instance Method Summary collapse

Instance Method Details

#active?Boolean

Returns true if this user is active, and should be able to log in. If the active column is false, the user will not be able to authenticate

Returns:

  • (Boolean)


16
17
18
# File 'lib/challah/concerns/user/attributeable.rb', line 16

def active?
  !!self.active
end

#nameObject

First name and last name together



21
22
23
# File 'lib/challah/concerns/user/attributeable.rb', line 21

def name
  "#{ first_name } #{ last_name }".strip
end

#small_nameObject

shortened name, just includes the first name and last initial



26
27
28
# File 'lib/challah/concerns/user/attributeable.rb', line 26

def small_name
  "#{ first_name.to_s.titleize } #{ last_name.to_s.first.upcase }."
end

#valid_session?Boolean

Is this user valid and ready for a user session?

Override this method if you need to check for a particular configuration on each page request.

Returns:

  • (Boolean)


33
34
35
# File 'lib/challah/concerns/user/attributeable.rb', line 33

def valid_session?
  self.active?
end