class Apartment::Elevators::HostHash
Uses a hash to find the corresponding tenant name for the host
Provides a rack based tenant switching solution based on hosts
def initialize(app, hash = {}, processor = nil)
def initialize(app, hash = {}, processor = nil) super app, processor @hash = hash end
def parse_tenant_name(request)
def parse_tenant_name(request) unless @hash.key?(request.host) raise TenantNotFound, "Cannot find tenant for host #{request.host}" end @hash[request.host] end