From 235488ec775c5eebb82f8761d7a1dd8357b521e7 Mon Sep 17 00:00:00 2001 From: Rob Kaufman Date: Thu, 21 Sep 2023 00:16:47 -0700 Subject: [PATCH] account elevator clear especially when on proprieter view --- app/middleware/account_elevator.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/middleware/account_elevator.rb b/app/middleware/account_elevator.rb index 1bdf38e85..6160b9a6e 100644 --- a/app/middleware/account_elevator.rb +++ b/app/middleware/account_elevator.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'apartment/elevators/generic' # Apartment middleware for switching tenants based on the # CNAME entry for an account. class AccountElevator < Apartment::Elevators::Generic @@ -7,7 +8,7 @@ class AccountElevator < Apartment::Elevators::Generic # @return [String] The tenant to switch to def parse_tenant_name(request) account = Account.from_request(request) - + account || Account.new.reset! # reset everything if no account is present account&.tenant end end