Skip to content

Commit

Permalink
account elevator clear especially when on proprieter view
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed Sep 21, 2023
1 parent e60efac commit 235488e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/middleware/account_elevator.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# 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
include AccountSwitch
# @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

0 comments on commit 235488e

Please sign in to comment.