Class: Role

Inherits:
Object
  • Object
show all
Extended by:
RoleClass::ClassMethods
Includes:
MongoMapper::Document, MongoMapper::EmbeddedDocument
Defined in:
lib/roles_mongo_mapper/role_class.rb,
lib/roles_mongo_mapper/embedded_role.rb

Class Method Summary collapse

Methods included from RoleClass::ClassMethods

find_role, find_roles

Class Method Details

.find_role(role_name) ⇒ Object

Raises:

  • (ArgumentError)


28
29
30
31
# File 'lib/roles_mongo_mapper/embedded_role.rb', line 28

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



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

def find_roles(*role_names)  
  role_names.flatten!
  by_names(role_names).all
end