Exception: Apartment::TenantRequired

Inherits:
ApartmentError show all
Defined in:
lib/apartment/errors.rb

Overview

Raised by Apartment::Tenant.require_tenant! when the effective tenant is the default (or unset) — routed data must not land in the default keyspace.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current = nil) ⇒ TenantRequired

Returns a new instance of TenantRequired.



88
89
90
91
92
93
94
95
96
# File 'lib/apartment/errors.rb', line 88

def initialize(current = nil)
  @current = current
  super(
    'Expected an explicit, non-default tenant context, but the effective ' \
    "tenant is #{current.inspect}. Wrap the work in " \
    'Apartment::Tenant.switch(name) { ... } — routed data must not use the ' \
    'default keyspace.'
  )
end

Instance Attribute Details

#currentObject (readonly)

Returns the value of attribute current.



86
87
88
# File 'lib/apartment/errors.rb', line 86

def current
  @current
end