ErwinM / acts_as_tenant

Easy multi-tenancy for Rails in a shared database setup.
MIT License
1.56k stars 264 forks source link

Allow optional: true to then skip the requires_tenant setting #287

Open gommo opened 2 years ago

gommo commented 2 years ago

We ran into a use case that I'd like to see if others would find useful. We have patched active_storage to be tenanted however there are other gems like action_mailbox which use storage (and how we route we don't have the tenant initially) I was thinking it may be useful to honor the optional: true on the acts_as_tenant option to then skip requiring a tenant in that case.

nightcoding commented 7 months ago

This would be very helpful! I currently have this requirement:

when a new user signs up, a tenant is not yet needed. If sign up was successful, the user has to create the tenant. After some confirmations (manually, because legally required to) the require_tenant is neccessary on every user update.

It would be very helpful if I could disable the validation on new records like with ActsAsTenants.without_tenant do ... end.