aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2016-05-11 08:36:46 -0400
committerArthur Neves <arthurnn@gmail.com>2016-05-11 08:37:56 -0400
commit897decaceb0e48669391af7e20b7b7aff848e6d7 (patch)
treeb0d311d9549399297eac86150fc1033ecc9408a3 /activerecord
parent525fa7ef7ce02bf3bfd99058ea18547f21c4f715 (diff)
downloadrails-897decaceb0e48669391af7e20b7b7aff848e6d7.tar.gz
rails-897decaceb0e48669391af7e20b7b7aff848e6d7.tar.bz2
rails-897decaceb0e48669391af7e20b7b7aff848e6d7.zip
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.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_handling.rb4
1 files changed, 2 insertions, 2 deletions
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