Class: Georgia::User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/georgia/user.rb

Instance Method Summary collapse

Instance Method Details

#has_role?(role) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
# File 'app/models/georgia/user.rb', line 9

def has_role? role
  return false unless role
  @role_names ||= roles.map(&:name)
  @role_names.include? role.to_s.titleize
end

#nameObject



18
19
20
# File 'app/models/georgia/user.rb', line 18

def name
  [first_name, last_name].join(' ')
end

#roles_namesObject



22
23
24
# File 'app/models/georgia/user.rb', line 22

def roles_names
  roles.map(&:name).join(', ')
end