From 6bd8e351361a895e7ada7d7702bb099034103d62 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Sun, 26 Feb 2006 23:12:01 +0000 Subject: ActiveRecord::Base.remove_connection explicitly closes database connections and doesn't corrupt the connection cache. Introducing the disconnect! instance method for the PostgreSQL, MySQL, and SQL Server adapters; implementations for the others are welcome. References #3591. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3674 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_record/connection_adapters/postgresql_adapter.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb') diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index a5bef4138d..86b89c6c1c 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -75,6 +75,11 @@ module ActiveRecord configure_connection end end + + def disconnect! + # Both postgres and postgres-pr respond to :close + @connection.close rescue nil + end def native_database_types { -- cgit v1.2.3