lib/generators/apartment/install/templates/apartment.rb in apartment-1.0.2 vs lib/generators/apartment/install/templates/apartment.rb in apartment-1.1.0

- old
+ new

@@ -3,10 +3,11 @@ # Require whichever Elevator you're using below or none if you have a custom one. # # require 'apartment/elevators/generic' # require 'apartment/elevators/domain' require 'apartment/elevators/subdomain' +# require 'apartment/elevators/first_subdomain' # # Apartment Configuration # Apartment.configure do |config| @@ -16,14 +17,37 @@ # # config.excluded_models = %w{ Tenant } # In order to migrate all of your Tenants you need to provide a list of Tenant names to Apartment. # You can make this dynamic by providing a Proc object to be called on migrations. - # This object should yield an array of strings representing each Tenant name. + # This object should yield either: + # - an array of strings representing each Tenant name. + # - a hash which keys are tenant names, and values custom db config (must contain all key/values required in database.yml) # # config.tenant_names = lambda{ Customer.pluck(:tenant_name) } # config.tenant_names = ['tenant1', 'tenant2'] + # config.tenant_names = { + # 'tenant1' => { + # adapter: 'postgresql', + # host: 'some_server', + # port: 5555, + # database: 'postgres' # this is not the name of the tenant's db + # # but the name of the database to connect to before creating the tenant's db + # # mandatory in postgresql + # }, + # 'tenant2' => { + # adapter: 'postgresql', + # database: 'postgres' # this is not the name of the tenant's db + # # but the name of the database to connect to before creating the tenant's db + # # mandatory in postgresql + # } + # } + # config.tenant_names = lambda do + # Tenant.all.each_with_object({}) do |tenant, hash| + # hash[tenant.name] = tenant.db_configuration + # end + # end # config.tenant_names = lambda { ToDo_Tenant_Or_User_Model.pluck :database } # # ==> PostgreSQL only options @@ -63,5 +87,6 @@ # request.host.split('.').first # } # Rails.application.config.middleware.use 'Apartment::Elevators::Domain' Rails.application.config.middleware.use 'Apartment::Elevators::Subdomain' +# Rails.application.config.middleware.use 'Apartment::Elevators::FirstSubdomain'