You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following Active record relationship in my application
class Client < ApplicationRecord
resourcify
end
class SupportGroup < ApplicationRecord
resourcify
end
class User < ApplicationRecord
end
I'm using rolify gem 5.x.
The actual problem is.
I have around 6k SupportGroup records in my Postgres db and I have na user 'xyz'. he is not bound to any of the support groups as an approver.
But using the following query I'm getting all 6k records
user = User.find_by!(name: 'xyz') supported_by_ids = SupportGroup.with_role(:approver, user).pluck(:id)
Expected behavior:
I should not be getting an supported_by_ids as the user('xyz') is not bound to any support group as an approver
The text was updated successfully, but these errors were encountered:
siddushar
changed the title
with_role returns all aata more than expected
with_role returns all the records more than expected
Jan 16, 2024
I have the following Active record relationship in my application
I'm using rolify gem 5.x.
The actual problem is.
I have around 6k SupportGroup records in my Postgres db and I have na user 'xyz'. he is not bound to any of the support groups as an approver.
But using the following query I'm getting all 6k records
user = User.find_by!(name: 'xyz') supported_by_ids = SupportGroup.with_role(:approver, user).pluck(:id)
Expected behavior:
I should not be getting an supported_by_ids as the user('xyz') is not bound to any support group as an approver
The text was updated successfully, but these errors were encountered: