ErwinM / acts_as_tenant

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

require_tenant set in initializer; not able to use ::with_tenant block without throwing NoTenantSet exception #302

Closed arifb closed 7 months ago

arifb commented 1 year ago

Hi,

In my initializer I have ActsAsTenant.configure { |config| config.require_tenant = true }

I thought I'd be able to do something like ActsAsTenant.with_tenant(tenant) { tenant.some_method } but a ActsAsTenant::Errors::NoTenantSet is thrown.

A workaround is to use a without_tenant block but is that the intention? Or is it a bug?

Thanks.