From 0877435e4f5e0f3bfcd65aec37ea1a31b502e112 Mon Sep 17 00:00:00 2001 From: alveslobom Date: Tue, 30 Dec 2014 12:02:28 +0100 Subject: [PATCH] FixBUG mongoid --- lib/rolify/adapters/mongoid/resource_adapter.rb | 4 ++-- lib/rolify/resource.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rolify/adapters/mongoid/resource_adapter.rb b/lib/rolify/adapters/mongoid/resource_adapter.rb index a32eadc8..8a3f48b1 100644 --- a/lib/rolify/adapters/mongoid/resource_adapter.rb +++ b/lib/rolify/adapters/mongoid/resource_adapter.rb @@ -12,7 +12,7 @@ def find_roles(role_name, relation, user) end def resources_find(roles_table, relation, role_name) - roles = roles_table.classify.constantize.where(:name.in => Array(role_name), :resource_type.in => self.relation_types_for(relation)) + roles = roles_table.classify.constantize.in(:name => Array(role_name), :resource_type => self.relation_types_for(relation)) resources = [] roles.each do |role| if role.resource_id.nil? @@ -41,4 +41,4 @@ def applied_roles(relation, children) end end -end \ No newline at end of file +end diff --git a/lib/rolify/resource.rb b/lib/rolify/resource.rb index dca83bc3..428c95ac 100644 --- a/lib/rolify/resource.rb +++ b/lib/rolify/resource.rb @@ -16,7 +16,7 @@ def with_role(role_name, user = nil) role_name = role_name.to_s end - resources = self.adapter.resources_find(self.role_table_name, self, role_name) #.map(&:id) + resources = self.adapter.resources_find(self.role_cname, self, role_name) user ? self.adapter.in(resources, user, role_name) : resources end alias :with_roles :with_role