diff options
author | Arthur Neves <arthurnn@gmail.com> | 2016-05-11 13:37:14 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2016-05-11 13:39:26 -0400 |
commit | 537a342a8307ebe1d5e69a7e81495f137ae571a4 (patch) | |
tree | 0be0087446c5f14beaf8156bdd9a604a1629234e /activerecord/lib/active_record | |
parent | 59d252196b36f6afaafd231756d69ea21537cf5d (diff) | |
download | rails-537a342a8307ebe1d5e69a7e81495f137ae571a4.tar.gz rails-537a342a8307ebe1d5e69a7e81495f137ae571a4.tar.bz2 rails-537a342a8307ebe1d5e69a7e81495f137ae571a4.zip |
remove_connection should not remove parent connection
When calling remove_connection in a subclass, that should not fallback
to the parent, otherwise it will remove the parent connection from the
handler.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_handling.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_handling.rb b/activerecord/lib/active_record/connection_handling.rb index 25306d6945..f932deb18d 100644 --- a/activerecord/lib/active_record/connection_handling.rb +++ b/activerecord/lib/active_record/connection_handling.rb @@ -132,7 +132,8 @@ module ActiveRecord connection_handler.connected?(connection_specification_name) end - def remove_connection(name = connection_specification_name) + def remove_connection(name = nil) + name ||= @connection_specification_name if defined?(@connection_specification_name) # if removing a connection that have a pool, we reset the # connection_specification_name so it will use the parent # pool. |