Closed jimmypoulsen closed 1 year ago
I don't think we plan to support that. It's safer to have the tenant_id
on each model because they can then be queried directly without the joins and just generally protects you since every record knows which tenant they belong to.
Actually, this may do what you wanted: https://github.com/ErwinM/acts_as_tenant/commit/a05d9a2e07dc396fd56c857e7934bef67bd9dbc9
I came to the same conclusion because of the issue with using joins so I just implemented the tenant_id
on all tenant records. I don't think a05d9a2 would have solved my problem as I wasn't looking for a way to associate them using a has_and_belongs_to_many
association. In my example a case file has many offers but an offer only belongs to one case file.
Hi.
We're currently implementing multi-tenancy in our single tenant application. Most of our application involves our
CaseFile
model. A case file has many offers, time entries and expenses. See the following model:Neither offers, time entries or expenses can exist without a case file so I want to avoid having the
account
association on each of these models. I only want to have it onCaseFile
.Is this possible?