I have a STI called Person
, I have 3 types: Contact
, User
and Tenant
. Contact
and Tenant
belongs to one organization, so they have an organization_id
column right in the "people" table.
The issue is that the type User
may have multiple organizations, so it has a dedicated table named "users_privileges". Currently, the organization_id
in the table "people" is null
for the type User
, since many users have two organizations.
Is there anyway to tell ActiveRecord when I do let say Person.all
, that for the type User
, it must not check the column organization_id in the table "people" and look for the has_many in "users_privileges" table?