Class: StandardHealth::Checks::ActiveRecord
- Inherits:
-
StandardHealth::Check
- Object
- StandardHealth::Check
- StandardHealth::Checks::ActiveRecord
- Defined in:
- lib/standard_health/checks/active_record.rb
Overview
Verifies the primary database connection by executing ‘SELECT 1`. Critical by default — if the database is unreachable, the host app cannot serve meaningful traffic.
Instance Attribute Summary
Attributes inherited from StandardHealth::Check
Instance Method Summary collapse
-
#initialize(name: :active_record, critical: true) ⇒ ActiveRecord
constructor
A new instance of ActiveRecord.
- #run ⇒ Object
Methods inherited from StandardHealth::Check
Constructor Details
#initialize(name: :active_record, critical: true) ⇒ ActiveRecord
Returns a new instance of ActiveRecord.
11 12 13 |
# File 'lib/standard_health/checks/active_record.rb', line 11 def initialize(name: :active_record, critical: true) super end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 |
# File 'lib/standard_health/checks/active_record.rb', line 15 def run with_timing do ::ActiveRecord::Base.connection.execute("SELECT 1") end end |