Skip to content

Commit c32aa19

Browse files
committed
Add real-world example showcase and badges to README
- Add comprehensive Announcement model example showing Rails Lens annotations - Include Mermaid ERD diagram demonstrating polymorphic relationships - Add GitHub badges for version, stars, downloads, and license - Demonstrate tangible value with performance notes and enum detection - Clear call-to-action for immediate trial
1 parent df587c5 commit c32aa19

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Rails Lens 🔍
22

3+
![Gem Version](https://img.shields.io/gem/v/rails_lens)
4+
![GitHub stars](https://img.shields.io/github/stars/seuros/rails_lens)
5+
![Downloads](https://img.shields.io/gem/dt/rails_lens)
6+
![License](https://img.shields.io/github/license/seuros/rails_lens)
7+
38
> **Precision optics for the Rails universe** - Where every model has perfect clarity through spacetime
49
510
Rails Lens provides intelligent model annotations and ERD generation for Rails applications with database-specific adapters, multi-database support, and advanced code analysis.
@@ -26,6 +31,71 @@ Rails Lens provides intelligent model annotations and ERD generation for Rails a
2631
**✨ Advanced Features:**
2732
- STI hierarchy mapping • Delegated types • Polymorphic associations • Enum analysis • LRDL-optimized output
2833

34+
## Showcase: Real-World Example
35+
36+
Rescued from AWS limbo, Rails Lens delivers cosmic schema clarity. See this `Announcement` model:
37+
38+
```ruby
39+
# frozen_string_literal: true
40+
41+
# <rails-lens:schema:begin>
42+
# table = "announcements"
43+
# database_dialect = "PostgreSQL"
44+
#
45+
# columns = [
46+
# { name = "id", type = "integer", primary_key = true, nullable = false },
47+
# { name = "body", type = "text", nullable = true },
48+
# { name = "audience", type = "string", nullable = true },
49+
# { name = "scheduled_at", type = "datetime", nullable = true },
50+
# { name = "created_at", type = "datetime", nullable = false },
51+
# { name = "updated_at", type = "datetime", nullable = false }
52+
# ]
53+
#
54+
# == Polymorphic Associations
55+
# Polymorphic Targets:
56+
# - entry (as: :entryable)
57+
#
58+
# == Enums
59+
# - audience: { all_users: "all_users", crew_only: "crew_only", officers_only: "officers_only", command_staff: "command_staff" } (string)
60+
#
61+
# == Notes
62+
# - Column 'body' should probably have NOT NULL constraint
63+
# - Column 'audience' should probably have NOT NULL constraint
64+
# - String column 'audience' has no length limit - consider adding one
65+
# - Large text column 'body' is frequently queried - consider separate storage
66+
# <rails-lens:schema:end>
67+
class Announcement < ApplicationRecord
68+
enum :audience, { all_users: 'all_users', crew_only: 'crew_only', officers_only: 'officers_only', command_staff: 'command_staff' }, suffix: true
69+
has_one :entry, as: :entryable, dependent: :destroy
70+
validates :audience, presence: true
71+
validates :body, presence: true
72+
scope :recent, -> { order(created_at: :desc) }
73+
end
74+
```
75+
76+
**ERD Visualization:**
77+
```mermaid
78+
erDiagram
79+
Announcement ||--o{ Entry : entryable
80+
Announcement {
81+
integer id PK
82+
text body
83+
string audience
84+
datetime scheduled_at
85+
datetime created_at
86+
datetime updated_at
87+
}
88+
Entry {
89+
integer id PK
90+
string entryable_type
91+
integer entryable_id
92+
datetime created_at
93+
datetime updated_at
94+
}
95+
```
96+
97+
**No grepping, no LLM hallucinations. Try it:** `gem install rails_lens`
98+
2999
## Requirements
30100

31101
- Ruby >= 3.4.0

0 commit comments

Comments
 (0)