diff options
author | Arthur Neves <arthurnn@gmail.com> | 2016-05-11 08:36:46 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2016-05-11 08:37:56 -0400 |
commit | 897decaceb0e48669391af7e20b7b7aff848e6d7 (patch) | |
tree | b0d311d9549399297eac86150fc1033ecc9408a3 /activerecord | |
parent | 525fa7ef7ce02bf3bfd99058ea18547f21c4f715 (diff) | |
download | rails-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.rb | 4 |
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 |