diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-30 13:43:11 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-30 17:44:49 -0300 |
commit | b6727a1ed3ca35d4788f52f0bea49952a16cd41e (patch) | |
tree | 930fbf4da5abe70b67a0a92cacaaa407e823741c /activerecord/lib | |
parent | 9f1b689cd93f448e2194fda552037b77cd8ea794 (diff) | |
download | rails-b6727a1ed3ca35d4788f52f0bea49952a16cd41e.tar.gz rails-b6727a1ed3ca35d4788f52f0bea49952a16cd41e.tar.bz2 rails-b6727a1ed3ca35d4788f52f0bea49952a16cd41e.zip |
Merge pull request #6477 from steveklabnik/close_discovered_pg_connection
Properly discover a connection is closed in postgresql_adapter
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 2d1517b65e..822f8f73de 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -344,7 +344,8 @@ module ActiveRecord # Is this connection alive and ready for queries? def active? - @connection.status == PGconn::CONNECTION_OK + @connection.query 'SELECT 1' + true rescue PGError false end |