Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FixBUG mongoid #304

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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