Class: AppStatus::Adapters::ActiveRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/app_status/adapters/active_record.rb

Class Method Summary collapse

Class Method Details

.adapter_nameObject



16
17
18
19
20
# File 'lib/app_status/adapters/active_record.rb', line 16

def self.adapter_name
  if defined?(::ActiveRecord)
    ::ActiveRecord::Base.connection.adapter_name
  end
end

.statusObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/app_status/adapters/active_record.rb', line 4

def self.status
  if defined?(::ActiveRecord)
    ::ActiveRecord::Base.connection.execute("SELECT 1=1").first.present? ? 'OK' : 'o_O'
  else
    'N/A'
  end
rescue => e
  AppStatus.logger.error "STATUS ERROR: #{adapter_name}"
  AppStatus.logger.error e
  'Down'
end