Module: RoleStrategy::MongoMapper::AdminFlag::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#in_role(role_name) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/roles_mongo_mapper/strategy/single/admin_flag.rb', line 19

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



15
16
17
# File 'lib/roles_mongo_mapper/strategy/single/admin_flag.rb', line 15

def role_attribute
  strategy_class.roles_attribute_name.to_sym
end