From 897decaceb0e48669391af7e20b7b7aff848e6d7 Mon Sep 17 00:00:00 2001 From: Arthur Neves Date: Wed, 11 May 2016 08:36:46 -0400 Subject: Set conn_spec_name after remove `remove_connection` can reset the `connection_specification_name`, so we need to to set it after the remove_connection call on `establish_connection` method. --- activerecord/lib/active_record/connection_handling.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index 0a69ad2c0e..74bbf6fc36 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -51,13 +51,13 @@ module ActiveRecord resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new configurations # TODO: uses name on establish_connection, for backwards compatibility spec = resolver.spec(spec, self == Base ? "primary" : name) - self.connection_specification_name = spec.name unless respond_to?(spec.adapter_method) raise AdapterNotFound, "database configuration specifies nonexistent #{spec.config[:adapter]} adapter" end - remove_connection + remove_connection(spec.name) + self.connection_specification_name = spec.name connection_handler.establish_connection spec end -- cgit v1.2.3