Skip to content

Commit

Permalink
Merge branch 'main' into index_job_tidying
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkkwang authored Sep 21, 2023
2 parents 5ea9895 + a3be534 commit 802e895
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 802e895

Please sign in to comment.