How to detect and simply signal that the DB is/got down?

Hi all,

If the DB server is down when the rails server starts, or if it gets
down while the rails server is running, I need to

  • detect the problem
  • display a simple error message “DB is down: contact support”.

Inserting
ActiveRecord::Base.retrieve_connection()
at the very begining of ApplicationController will trigger an error -
that can be captured - when the class is loaded, but before the
controller is instantiated => cannot render anything.
And it would not help if the DB gets down after the app has been running
(and the controller has been cached).

How can I solve this problem?
Thanks in advance.

Alain

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs