ErwinM / acts_as_tenant

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

Global record #247

Closed pruzicka closed 3 years ago

pruzicka commented 3 years ago

Hi, does 'has_global_records: true' still work as described in #150 ? When I try to modify record to have tenant_id as nill I get "ActsAsTenant::Errors::TenantIsImmutable (ActsAsTenant::Errors::TenantIsImmutable)".
My model has acts_as_tenant :organization, has_global_records: true

Thank you

pruzicka commented 3 years ago

Hi, does 'has_global_records: true' still work as described in #150 ? When I try to modify record to have tenant_id as nill I get "ActsAsTenant::Errors::TenantIsImmutable (ActsAsTenant::Errors::TenantIsImmutable)". My model has acts_as_tenant :organization, has_global_records: true

Thank you

...and I should add that I'm was able to create new record with tenant set to nil either, as I got error from ActiveRecord "ActiveRecord::RecordInvalid (Validation failed: Organization must exist)". I was able to fix it by adding "optional: true" to acts_as_tenant options.