Skip to content

Commit

Permalink
FixBUG mongoid
Browse files Browse the repository at this point in the history
  • Loading branch information
kairel committed Dec 30, 2014
1 parent 5856f46 commit 0877435
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/rolify/adapters/mongoid/resource_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -41,4 +41,4 @@ def applied_roles(relation, children)

end
end
end
end
2 changes: 1 addition & 1 deletion lib/rolify/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0877435

Please sign in to comment.