Class: Connectors::Postgresql
- Inherits:
-
Object
- Object
- Connectors::Postgresql
- Defined in:
- lib/connectors/postgresql.rb
Overview
Postgres health checker
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.configured? ⇒ Boolean
16 17 18 19 20 |
# File 'lib/connectors/postgresql.rb', line 16 def self.configured? raise StandardError, 'Please make sure you have Postgres installed' unless defined?(::ActiveRecord::Base) 'configured' end |
Instance Method Details
#connect ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/connectors/postgresql.rb', line 6 def connect @conn = ActiveRecord::Base.connection true rescue ::PG::ConnectionBad puts "Postgres Connection Error: #{e.message}" false ensure @conn&.close end |