Files
rails-test/app/controllers/home_controller.rb
2026-01-15 12:26:30 +06:30

20 lines
383 B
Ruby

class HomeController < ApplicationController
def index
@db_status = check_database
@timestamp = Time.current
end
def health
render json: { status: "ok", database: check_database, timestamp: Time.current }
end
private
def check_database
ActiveRecord::Base.connection.execute("SELECT 1")
"connected"
rescue => e
"error: #{e.message}"
end
end