Module: RoleStrategy::DataMapper::AdminFlag::ClassMethods
- Defined in:
- lib/roles_data_mapper/strategy/single/admin_flag.rb
Instance Method Summary collapse
Instance Method Details
#in_any_role(*role_names) ⇒ Object
28 29 30 31 |
# File 'lib/roles_data_mapper/strategy/single/admin_flag.rb', line 28 def in_any_role(*role_names) role_names = role_names.flatten all(role_attribute => role_names) end |
#in_role(role_name) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/roles_data_mapper/strategy/single/admin_flag.rb', line 18 def in_role(role_name) puts "in role: #{role_name}" case role_name.downcase.to_sym when :admin all(role_attribute => :admin) else all(role_attribute => :guest) end end |
#role_attribute ⇒ Object
14 15 16 |
# File 'lib/roles_data_mapper/strategy/single/admin_flag.rb', line 14 def role_attribute strategy_class.roles_attribute_name.to_sym end |