influitive / apartment

Database multi-tenancy for Rack (and Rails) applications
2.67k stars 463 forks source link

warning: instance variable not initialized #538

Closed esasse closed 5 years ago

esasse commented 6 years ago

I'm getting a lot (hundreds) of warnings when I run my rspec tests with --warning flag enabled.

/Users/esasse/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/apartment-2.1.0/lib/apartment.rb:66: warning: instance variable @connection_class not initialized
/Users/esasse/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/apartment-2.1.0/lib/apartment.rb:66: warning: instance variable @connection_class not initialized
/Users/esasse/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/apartment-2.1.0/lib/apartment/adapters/abstract_adapter.rb:46: warning: instance variable @default_tenant not initialized
/Users/esasse/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/apartment-2.1.0/lib/apartment.rb:66: warning: instance variable @connection_class not initialized
/Users/esasse/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/apartment-2.1.0/lib/apartment.rb:62: warning: instance variable @persistent_schemas not initialized

System configuration

require "apartment/elevators/custom_subdomain"

Rails.env.on(:development, :test) do
  Apartment.configure do |config|
    config.tenant_names = %w[tenant_a]
  end
end

Rails.env.on(:production, :staging) do
  Apartment.configure do |config|
    config.tenant_names = %w[tenant_a tenant_b tenant_c]
  end
end

Apartment.configure do |config|
  config.prepend_environment = false
  config.seed_after_create = false
  config.default_schema = "tenant_a"
end

Rails.application.config.middleware.use Apartment::Elevators::CustomSubdomain
esasse commented 5 years ago

I can't reproduce with current version.