citusdata / citusdata/activerecord-multi-tenant

Any way to achieve two level multi-tenancy?

Open
#203 4 comments 0 reactions 1 assignee Claimed by @gurkanindibay View on GitHub
Dominant language
Ruby
Stars
759
Forks
113
PR merge metrics
No merged PRs in 30d

Description

Hello,

Thanks for implementing and supporting such a good gem we use in many of our projects!

We use the gem in our project to separate events such as fairs and conferences as tenants. They share users and have out-of-tenant configurations such as domains and routes, etc:

image

What we want is to add a completely new level of tenancy: vendors. Vendors should have their own separate scope of events, users and configurations:

image

As my experience with the activerecord-multi-tenant and common sense I see "Variant 2" as a viable option, where I would have two `multi_tenant` tables: `events` and `vendors`. On the contrary, `events` still should be dependent on `vendors` and it can mix up some stuff with database queries and the `MultiTenant.current_tenant` state.

"Variant 1" seems to me more logical and readable but I have no idea where to start with modifying the gem to make it work. I suppose it is doable to make it possible to pass the tenant as an array of a vendor and an event model as so: `MultiTenant.with([current_vendor, current_event])` but I wanted to ask you, the authors, what you think about it.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.