Initial Rails test app

This commit is contained in:
Min Zeya Phyo
2026-01-15 12:26:30 +06:30
commit 1733430341
19 changed files with 418 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
class ApplicationController < ActionController::Base
end

View File

@@ -0,0 +1,19 @@
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

View File

@@ -0,0 +1,20 @@
<div class="container">
<h1>Rails Test Application</h1>
<p>Unity Platform - Coolify Deployment Test</p>
<h3>Status</h3>
<div class="status <%= @db_status == 'connected' ? 'ok' : 'error' %>">
Database: <strong><%= @db_status %></strong>
</div>
<h3>Environment</h3>
<ul>
<li>Rails Version: <code><%= Rails.version %></code></li>
<li>Ruby Version: <code><%= RUBY_VERSION %></code></li>
<li>Environment: <code><%= Rails.env %></code></li>
<li>Server Time: <code><%= @timestamp %></code></li>
</ul>
<h3>Health Endpoint</h3>
<p>Check <a href="/health">/health</a> for JSON status</p>
</div>

View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Rails Test App</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 800px; margin: 50px auto; padding: 20px; background: #f5f5f5; }
.container { background: white; padding: 40px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
h1 { color: #cc0000; }
.status { padding: 10px 20px; border-radius: 5px; margin: 10px 0; }
.status.ok { background: #d4edda; color: #155724; }
.status.error { background: #f8d7da; color: #721c24; }
code { background: #e9ecef; padding: 2px 6px; border-radius: 3px; }
</style>
</head>
<body>
<%= yield %>
</body>
</html>