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

without_role is not working as expected if used to filter result of with_role. #420

Open
vshy108 opened this issue Oct 5, 2016 · 2 comments

Comments

@vshy108
Copy link

vshy108 commented Oct 5, 2016

version 5.1.0

One user might have multiple roles, when I tried to find those users that only has assistant role but does not have admin role, I found that I fail to get them with

User.with_role(:assistant).without_role(:admin)

and has TRUE result for following statement

User.with_role(:assistant).without_role(:admin).first.has_role?(:admin)

The result of following lines is different

User.with_role(:assistant).without_role(:admin)
Wrong result
User.without_role(:admin).with_role(:assistant)
Correct result

thanks

@vshy108 vshy108 changed the title without_role is not working as expected. without_role is not working as expected if used to filter result of with_role. Oct 5, 2016
@dagosi
Copy link

dagosi commented Apr 5, 2017

Is there any update on this?

@Petercopter
Copy link

Still a problem. Reordering the chain does work, thankfully 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants