79736822

Date: 2025-08-15 20:54:36
Score: 0.5
Natty:
Report link

As of Rails 7.2 (or earlier?) you can test for database connectivity explicitly:

ActiveRecord::Base.connection.verify!

This replaces two other (long deprecated, recently removed) methods:

if ActiveRecord::Base.connection.nil? || !ActiveRecord::Base.connected? ...

More details here: https://apidock.com/rails/ActiveRecord/ConnectionAdapters/AbstractAdapter/verify%21

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • High reputation (-1):
Posted by: David Hempy