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)


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

def active?
  !!self.active
end

#nameObject

First name and last name together



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

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

#small_nameObject

shortened name, just includes the first name and last initial



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

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)


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

def valid_session?
  self.active?
end