Last active
August 8, 2018 23:38
-
-
Save tiagogeraldi/03436bc3c8baba3e42d8212f1f263f55 to your computer and use it in GitHub Desktop.
Part of Apartment with no subdomain
This file contains 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
require 'apartment/elevators/generic' | |
Apartment.configure do |config| | |
# Your Customer model | |
config.excluded_models = %w{ Customer } | |
# Customer name will be the key of the tenant | |
config.tenant_names = lambda { Customer.pluck :name } | |
end | |
Rails.application.config.middleware.use Apartment::Elevators::Generic, lambda { |request| | |
request.session[:tenant] ? request.session[:tenant] : 'public' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment