Module: Multitenant
- Defined in:
- lib/multitenant.rb,
lib/multitenant/version.rb
Overview
Multitenant: making cross tenant data leaks a thing of the past…since 2011
Defined Under Namespace
Modules: ActiveRecordExtensions
Constant Summary collapse
- VERSION =
"0.4.0"
Class Attribute Summary collapse
-
.current_tenant ⇒ Object
Returns the value of attribute current_tenant.
Class Method Summary collapse
-
.with_tenant(tenant, &block) ⇒ Object
execute a block scoped to the current tenant unsets the current tenant after execution.
Class Attribute Details
.current_tenant ⇒ Object
Returns the value of attribute current_tenant.
6 7 8 |
# File 'lib/multitenant.rb', line 6 def current_tenant @current_tenant end |
Class Method Details
.with_tenant(tenant, &block) ⇒ Object
execute a block scoped to the current tenant unsets the current tenant after execution
10 11 12 13 14 15 |
# File 'lib/multitenant.rb', line 10 def with_tenant(tenant, &block) Multitenant.current_tenant = tenant yield ensure Multitenant.current_tenant = nil end |