Skip to content

with_role returns all the records more than expected #597

@siddushar

Description

@siddushar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions