Module: RoleStrategy::Mongoid::EmbedOneRole::ClassMethods
- Defined in:
- lib/roles_mongoid/strategy/single/embed_one_role.rb
Instance Method Summary collapse
- #in_any_role(*role_names) ⇒ Object
- #in_role(role_name) ⇒ Object
- #role_attribute ⇒ Object
- #role_attribute_id ⇒ Object
Instance Method Details
#in_any_role(*role_names) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/roles_mongoid/strategy/single/embed_one_role.rb', line 27 def in_any_role(*role_names) begin any_in("one_role.name" => role_names) rescue return [] end end |
#in_role(role_name) ⇒ Object
23 24 25 |
# File 'lib/roles_mongoid/strategy/single/embed_one_role.rb', line 23 def in_role(role_name) in_any_role(role_name) end |
#role_attribute ⇒ Object
15 16 17 |
# File 'lib/roles_mongoid/strategy/single/embed_one_role.rb', line 15 def role_attribute strategy_class.roles_attribute_name.to_sym end |
#role_attribute_id ⇒ Object
19 20 21 |
# File 'lib/roles_mongoid/strategy/single/embed_one_role.rb', line 19 def role_attribute_id "#{role_attribute}_id" end |