Created
June 29, 2016 05:56
-
-
Save devkinoti/5dcd2a77ec579dd38c4da7a36800e7cf to your computer and use it in GitHub Desktop.
tenant middleware to catch apartment tenant not found cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TenantMiddleware < Apartment::Elevators::Subdomain | |
| def call(*args) | |
| begin | |
| super | |
| rescue Apartment::TenantNotFound | |
| Rails.logger.error "Error: Apartment Tenant Not found: #{Apartment::Tenant.current.inspect}" | |
| return [404, {"Content-Type" => "application/json"},["Error => Tenant not found"]] | |
| end | |
| end | |
| # def parse_tenant_name(request) | |
| # request.env["HTTP_X_TENANT"] | |
| # end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment