Module: RoleStrategy::Generic::EmbedManyRoles::Implementation

Includes:
Roles::Generic::User::Implementation::Multi
Defined in:
lib/roles_generic/strategy/multi/embed_many_roles.rb

Instance Method Summary collapse

Methods included from Roles::Generic::User::Implementation::Multi

#add_roles, #remove_roles, #roles_list

Instance Method Details

#new_roles(*role_names) ⇒ Object



10
11
12
# File 'lib/roles_generic/strategy/multi/embed_many_roles.rb', line 10

def new_roles *role_names   
  role_class.find_roles(extract_roles role_names)        
end

#present_roles(roles_names) ⇒ Object



14
15
16
# File 'lib/roles_generic/strategy/multi/embed_many_roles.rb', line 14

def present_roles roles_names
  roles_names.to_a.map{|role| role.name.to_s.to_sym}        
end

#set_empty_rolesObject



18
19
20
# File 'lib/roles_generic/strategy/multi/embed_many_roles.rb', line 18

def set_empty_roles
  self.send("#{role_attribute}=", [])
end