Module: RoleClass::ClassMethods

Included in:
Role
Defined in:
lib/roles_mongo_mapper/role.rb

Instance Method Summary collapse

Instance Method Details

#find_role(role_name) ⇒ Object

Raises:

  • (ArgumentError)


23
24
25
26
# File 'lib/roles_mongo_mapper/role.rb', line 23

def find_role role_name
  raise ArgumentError, "#find_role takes a single role name as argument, not: #{role_name.inspect}" if !role_name.kind_of_label?
  by_name(role_name).first
end

#find_roles(*role_names) ⇒ Object



17
18
19
20
21
# File 'lib/roles_mongo_mapper/role.rb', line 17

def find_roles(*role_names)  
  role_names.flatten!
  by_names(role_names).all
  # where(:name => role_names.to_strings).all 
end