Class: User

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models/user.rb

Instance Method Summary collapse

Instance Method Details

#authenticate(password) ⇒ Object



48
49
50
# File 'app/models/user.rb', line 48

def authenticate password
  self&.valid_password?(password) ? self : nil
end

#display_nameObject



40
41
42
# File 'app/models/user.rb', line 40

def display_name
  email
end

#has_role?(role) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
# File 'app/models/user.rb', line 44

def has_role? role
  roles.include? role.to_s
end