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 13:43:11 -0700 |
commit | c56ef677058de800fbdd16affaf00af10832d69c (patch) | |
tree | 462b59ab25069d26ff4d5a194bbd5663d7b32ca3 | |
parent | fd97266a3f684bf1d41f702251fcb69ad9bd6dda (diff) | |
parent | 4dacac3baa271597e6bcf3527c557182d64a6a95 (diff) | |
download | rails-c56ef677058de800fbdd16affaf00af10832d69c.tar.gz rails-c56ef677058de800fbdd16affaf00af10832d69c.tar.bz2 rails-c56ef677058de800fbdd16affaf00af10832d69c.zip |
Merge pull request #6477 from steveklabnik/close_discovered_pg_connection
Properly discover a connection is closed in postgresql_adapter
-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 cf4a213580..03c318f5f7 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -457,7 +457,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 |