Module: RoleStrategy::Mongoid::AdminFlag::ClassMethods

Defined in:
lib/roles_mongoid/strategy/single/admin_flag.rb

Instance Method Summary collapse

Instance Method Details

#in_role(role_name) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/roles_mongoid/strategy/single/admin_flag.rb', line 16

def in_role(role_name) 
  case role_name.downcase.to_sym
  when :admin
    where(role_attribute => true)
  else
    where(role_attribute => false)
  end          
end

#role_attributeObject



12
13
14
# File 'lib/roles_mongoid/strategy/single/admin_flag.rb', line 12

def role_attribute
  strategy_class.roles_attribute_name.to_sym
end