Module: RoleStrategy::Mongoid::RoleStrings::ClassMethods

Defined in:
lib/roles_mongoid/strategy/multi/role_strings.rb

Instance Method Summary collapse

Instance Method Details

#in_role(role_name) ⇒ Object



16
17
18
# File 'lib/roles_mongoid/strategy/multi/role_strings.rb', line 16

def in_role(role_name)  
  in_roles(role_name)
end

#in_roles(*role_names) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/roles_mongoid/strategy/multi/role_strings.rb', line 20

def in_roles(*role_names)
  begin
    where(role_attribute.in => role_names).to_a      
  rescue
    return []
  end
end

#role_attributeObject



12
13
14
# File 'lib/roles_mongoid/strategy/multi/role_strings.rb', line 12

def role_attribute
  strategy_class.roles_attribute_name.to_sym
end