Module: RlsMultiTenant::Concerns::TenantContext
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/rls_multi_tenant/concerns/tenant_context.rb
Constant Summary collapse
- IDENTIFIER_PATTERN =
PostgreSQL unquoted identifier pattern, used to validate the configured tenant id column before embedding it in a GUC name.
/\A[a-zA-Z_][a-zA-Z0-9_]*\z/- SET_TENANT_ID_SQL =
'SET %s = %s'- SET_LOCAL_TENANT_ID_SQL =
'SET LOCAL %s = %s'- RESET_TENANT_ID_SQL =
'RESET %s'- RESET_LOCAL_TENANT_ID_SQL =
'SET LOCAL %s TO DEFAULT'
Instance Method Summary collapse
-
#switch(tenant_or_id, &block) ⇒ Object
Instance methods.
- #switch_by(value, attribute: RlsMultiTenant.subdomain_field, &block) ⇒ Object
Instance Method Details
#switch(tenant_or_id, &block) ⇒ Object
Instance methods
164 165 166 |
# File 'lib/rls_multi_tenant/concerns/tenant_context.rb', line 164 def switch(tenant_or_id, &block) self.class.switch(tenant_or_id, &block) end |
#switch_by(value, attribute: RlsMultiTenant.subdomain_field, &block) ⇒ Object
168 169 170 |
# File 'lib/rls_multi_tenant/concerns/tenant_context.rb', line 168 def switch_by(value, attribute: RlsMultiTenant.subdomain_field, &block) self.class.switch_by(value, attribute: attribute, &block) end |