aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
diff options
context:
space:
mode:
authorHongli Lai (Phusion) <hongli@phusion.nl>2009-01-13 16:01:44 +0100
committerJeremy Kemper <jeremy@bitsweat.net>2009-01-13 15:58:50 -0800
commit9bcf01b23c25e640da7908ac8b1b49fbf7d2e51a (patch)
tree78f7a9bc449265bbf666baafa52bcc9c88c2ffdc /activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
parentb281a6a5b2137548501ef590379d7af5f6955d2d (diff)
downloadrails-9bcf01b23c25e640da7908ac8b1b49fbf7d2e51a.tar.gz
rails-9bcf01b23c25e640da7908ac8b1b49fbf7d2e51a.tar.bz2
rails-9bcf01b23c25e640da7908ac8b1b49fbf7d2e51a.zip
Fix PostgreSQL unit test failures that only occur when using the old 'postgres' driver.
[#1748 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 5a8d99924d..913bb521ca 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -533,13 +533,11 @@ module ActiveRecord
execute "ROLLBACK"
end
- if PGconn.public_method_defined?(:transaction_status)
- # ruby-pg defines Ruby constants for transaction status,
- # ruby-postgres does not.
- PQTRANS_IDLE = defined?(PGconn::PQTRANS_IDLE) ? PGconn::PQTRANS_IDLE : 0
-
+ if defined?(PGconn::PQTRANS_IDLE)
+ # The ruby-pg driver supports inspecting the transaction status,
+ # while the ruby-postgres driver does not.
def outside_transaction?
- @connection.transaction_status == PQTRANS_IDLE
+ @connection.transaction_status == PGconn::PQTRANS_IDLE
end
end