Method: User#add_role

Defined in:
app/models/user.rb

#add_role(role) ⇒ Object

Role Methods




360
361
362
363
364
365
366
367
368
369
# File 'app/models/user.rb', line 360

def add_role(role)
  return false unless self.approved?
  role = Role.find_by_name(role) if role.is_a?(String)
  if role
    self.roles << role unless self.has_role?(role)
    return true
  else
    return false
  end
end