Module: Mongoid::Roles::Subject::ClassMethods
- Defined in:
- lib/mongoid/roles/subject.rb
Instance Method Summary collapse
-
#with_role(role, object) ⇒ Object
find all subjects which has given role for given object.
Instance Method Details
#with_role(role, object) ⇒ Object
find all subjects which has given role for given object
35 36 37 38 39 |
# File 'lib/mongoid/roles/subject.rb', line 35 def with_role role, object c = where('roles.auth_object_type' => object.class.name, 'roles.role' => role) c.selector['roles.auth_object_id'] = object.id.to_s # FIX, we want string instead of object_id... return c end |