Module: RoleStrategy::Generic::ManyRoles::Implementation
Instance Method Summary
collapse
#add_roles, #remove_roles, #roles_list
Instance Method Details
#new_roles(*role_names) ⇒ Object
10
11
12
|
# File 'lib/roles_generic/strategy/multi/many_roles.rb', line 10
def new_roles *role_names
role_class.find_roles( role_names)
end
|
#present_roles(roles_names) ⇒ Object
14
15
16
|
# File 'lib/roles_generic/strategy/multi/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_roles ⇒ Object
18
19
20
|
# File 'lib/roles_generic/strategy/multi/many_roles.rb', line 18
def set_empty_roles
self.send("#{role_attribute}=", [])
end
|