We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Users Table
Roles Table
RoleUser Pivot Table
users = User.where_has( 'roles', lambda q: q.where('slug', 'editor') ).get()
Expected Output
[ { "id": "1", "name": "John", }, { "id": "2", "name": "Jane", } ]
Current Output Expected Output
[ { "id": "1", "name": "John", } ]
Originally posted by @yubarajshrestha in #522 (comment)
The text was updated successfully, but these errors were encountered:
could have swore I tested this exact scenario but I'll replicate this again 🤔
Sorry, something went wrong.
SELECT * FROM "users" WHERE EXISTS (SELECT "role_user".* FROM "role_user" WHERE "role_user"."id" = "users"."id" AND "role_user"."id" IN (SELECT "roles"."id" FROM "roles" WHERE "roles"."slug" = 'editor'))
I can see that you're comparing role_user.id with users.id which is incorrect.
role_user.id
users.id
hmm. correct query should be
SELECT * FROM "users" WHERE EXISTS (SELECT "role_user".* FROM "role_user" WHERE "role_user"."user_id" = "users"."id" AND "role_user"."role_id" IN (SELECT "roles"."id" FROM "roles" WHERE "roles"."slug" = 'editor'))
Fixed in #529
No branches or pull requests
Users Table
Roles Table
RoleUser Pivot Table
Expected Output
Current Output
Expected Output
Originally posted by @yubarajshrestha in #522 (comment)
The text was updated successfully, but these errors were encountered: