Sha256: 002185476439a4fe69f54843284bcdab090b9e50827091c3458635c81e5e366c

Contents?: true

Size: 728 Bytes

Versions: 2

Compression:

Stored size: 728 Bytes

Contents

module Challah::User

  module Attributes
    # 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
    def active?
      !!self.active
    end

    # First name and last name together
    def name
      "#{first_name} #{last_name}".strip
    end

    # shortened name, just includes the first name and last initial
    def small_name
      "#{first_name.to_s.titleize} #{last_name.to_s.first.upcase}."
    end

    # 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.
    def valid_session?
      self.active?
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
challah-1.1.1 lib/challah/user/attributes.rb
challah-1.1.0 lib/challah/user/attributes.rb