From cc0d54bcc09a8ab834041787df69f6795a468b91 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sat, 8 Mar 2014 01:14:26 +1030 Subject: Teach PostgreSQLAdapter#reset! to actually reset It wasn't doing anything beyond clearing the statement cache. --- .../lib/active_record/connection_adapters/postgresql_adapter.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/connection_adapters') diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index e5f7913c70..49d1a20659 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -616,7 +616,12 @@ module ActiveRecord def reset! clear_cache! - super + reset_transaction + unless @connection.transaction_status == ::PG::PQTRANS_IDLE + @connection.query 'ROLLBACK' + end + @connection.query 'DISCARD ALL' + configure_connection end # Disconnects from the database if already connected. Otherwise, this -- cgit v1.2.3