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

with_role unexpected behaviour after strict with_role queries fix #564

Open
doncuomo opened this issue Jun 7, 2021 · 0 comments
Open

with_role unexpected behaviour after strict with_role queries fix #564

doncuomo opened this issue Jun 7, 2021 · 0 comments

Comments

@doncuomo
Copy link

doncuomo commented Jun 7, 2021

I think this is a bug, but I'm not sure. I think this PR is the cause of this behaviour: Click

We run strict mode

Our app has the following admin roles:

User.add_role(:admin) # Global
User.add_role(:admin, account) # On account instance
User.add_role(:admin, survey) # On survey instance

Say we have the follow example:

user_1.add_role(:admin)
user_2.add_role(:admin, account.first)
user_3.add_role(:admin, survey.first)

has_role?(:admin) returns the following:

user_1.has_role?(:admin) # true
user_2.has_role?(:admin) # false
user_3.has_role?(:admin) # false

But when I do:
User.with_role(:admin) # [user_1, user_2, user_3]

I would expect:
#[user_1]

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

1 participant