Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ActiveRecord doesn't notice that we need to join with `members` in two parts of the ActiveRecord::Relation and it joins it two times adding an alias called `members_users`, instead of joining that table just once. As the constraint on the `organization_id` was referencing the `members_users` table this wasn't picked up by Postgres while joining the tables. Specifically, when joining `users` with `members`, thus returning all members of a user, regardless of their organization.
- Loading branch information