Class: GranPulse::Database

Inherits:
Check
  • Object
show all
Defined in:
app/models/gran_pulse/database.rb

Instance Attribute Summary

Attributes inherited from Check

#healthy, #message, #type

Instance Method Summary collapse

Constructor Details

#initializeDatabase

Returns a new instance of Database.



3
4
5
# File 'app/models/gran_pulse/database.rb', line 3

def initialize
  self.type = 'database'
end

Instance Method Details

#performObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/models/gran_pulse/database.rb', line 7

def perform
  if defined?(ActiveRecord)
    if ActiveRecord::Base.connected?
      self.healthy = true
      self.message = 'ok'
    else
      self.healthy = false
      self.message = 'no_database_connected'
    end
  # elsif defined?(Mongoid)
  #   config = 
  else
    self.healthy = true
    self.message = 'no_database_defined'
  end
  self
end