Class: User

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

Instance Method Summary collapse

Instance Method Details

#authenticate(password) ⇒ Object



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

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

#display_nameObject



31
32
33
# File 'app/models/user.rb', line 31

def display_name
  email
end

#has_role?(role) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/models/user.rb', line 35

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