-
-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add additional pkeys to scope if given #323
base: master
Are you sure you want to change the base?
Conversation
Can you provide tests for this? |
@excid3 I definitely can. I put in this PR to get an idea if something like this would be welcomed. If it is, I will add tests and also need to modify the |
I think we need a good use-case / example to show why this is useful and should be added. That will help on how best to handle other changes if it makes sense to include. |
@excid3 I have a couple of use cases for two different projects. Both follow a very similar data-driven need though. In both cases, there's a master tenant that needs access to several child tenants' data, while the child tenant should only see its own data. Here's an example for a situation: In this case a
|
@excid3 thoughts? If you're on board, I'll write specs |
@excid3 ^^ ? |
This allows for the user, when setting up
acts_as_tenant
for a model, to specify an option for a method that the tenant responds to that will give additional pkeys for including in the default scope of the data.This allows for data from multiple tenants to be read in a tenant (without changing behavior of writing data). It works much in the same way that
has_global_records
does, but rather than global records, allows for other tenants' data to be included.