active?() Ver: 2.0.1
From: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter Version 2.0.1
Comments

Is this connection alive and ready for queries?

Sourcecode
# File /Users/nshb/svn/svn.inimit.com/railsmanual.com/www/trunk/src/rails-2.0.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb, line 241
      def active?
        if @connection.respond_to?(:status)
          @connection.status == PGconn::CONNECTION_OK
        else
          # We're asking the driver, not ActiveRecord, so use @connection.query instead of #query
          @connection.query 'SELECT 1'
          true
        end
      # postgres-pr raises a NoMethodError when querying if no connection is available.
      rescue PGError, NoMethodError
        false
      end
Add New Note User Added Notes