voormedia/rails-erd
72.6
Strong · 28 September 2026
4.4k
lines of production code
Ruby
primary language
2
measurements over time
What this system is
This system is a Ruby gem that generates Entity-Relationship Diagrams from Rails application models. It supports multiple output formats, primarily using Mermaid by default, while retaining optional Graphviz support. The tool provides extensive configuration options for filtering attributes, handling inheritance and polymorphism, and customizing diagram layouts. It also includes example applications and automated generation hooks to keep diagrams synchronized with database migrations.
How it got here
2010 — Mermaid migration and domain refactoring
21 changes.
The project shifted its default diagram generator from Graphviz to Mermaid, introducing new CLI options and configuration capabilities while dropping support for older Ruby and Rails versions. Concurrently, the domain model was significantly refactored to support single-table inheritance, polymorphic associations, and precise cardinality tracking. The release was accompanied by an extensive expansion of example applications and association patterns to demonstrate these new features.
2011–2015 — ERD generation enhancements and Rails compatibility
4 changes.
This period focused on expanding the ERD generation capabilities by introducing new HTML and Record templates with orientation support and an executable CLI interface. It also added automation features, such as a rake task to regenerate diagrams automatically during database migrations, while updating dependencies to support Rails versions 7.0 through 8.0.
Features
Add EventForms example application models and database schema
The EventForms example application now includes its data layer, introducing ActiveRecord models for organizations, groups, events, event dates, forms, form fields, and signups, along with the corresponding database schema. This provides the underlying structure for managing event registrations and custom form fields within the example.
_examples/applications/event\forms · high confidence
Add Rails ERD meta-example models and schema
The examples/meta directory now includes a complete set of ActiveRecord models and a database schema for the Rails ERD meta-example. This adds the necessary data structures (Domain, Entity, Relationship, Property, Cardinality, Specialization) and their associations, allowing users to generate entity-relationship diagrams from this sample domain model.
examples/meta · high confidence
Add single-table inheritance example for beverages
The examples/inheritance directory now includes a single-table inheritance demo using ActiveRecord models (Beverage, Beer, Whisky) and a corresponding schema. The example configuration enables inheritance mapping and hides the type attribute by default in the generated output.
examples/inheritance · high confidence
Added ERD generation executable
A new executable script at bin/erd has been added to allow users to easily create Entity-Relationship Diagrams. The script invokes the RailsERD CLI tool directly via Ruby.
bin · high confidence
Added Gemcutter example application models and schema
The Gemcutter example application now includes its core data models (User, Rubygem, Version, Ownership, Subscription, Dependency, WebHook, etc.) and the corresponding database schema. This provides a complete reference implementation for the application's data layer, including relationships and validations.
examples/applications/gemcutter · high confidence
Added Spree domain model and example application structure
The examples/applications/spree directory now includes a complete Spree e-commerce domain model, providing a reference implementation for users. This addition introduces core entities such as Product, Order, Variant, and Checkout, along with supporting models for payments (Gateways, Creditcards), shipping (Shipments, ShippingMethods), and taxes (TaxRates, Calculators). It also includes a custom \delegate\_belongs\_to\ helper to simplify association access and a database schema definition to facilitate local setup.
examples/applications/spree · high confidence
Added Typo blog application example with schema and configuration
This change introduces a new example application for Typo, a Ruby-based blogging platform. It includes the MIT license file, a configuration file (\options.rb\) enabling inheritance by default, and a comprehensive ActiveRecord schema (\schema.rb\) defining the database structure for blogs, articles, categories, users, and related content. This provides users with a concrete reference implementation for integrating the library with a real-world blogging scenario.
examples/applications/typo · high confidence
Added example application models with Rails 4 compatibility
The example application in examples/applications/typo/models now includes a complete set of ActiveRecord models (Article, Blog, Category, Comment, Content, Feedback, Notification, Page, Ping, Profile, Redirect, Resource, Right, Sidebar, Tag, TextFilter, Trackback, Trigger, and User). These models implement relationships and validations, with specific conditional logic to support both Rails 3 and Rails 4 (checking ActiveRecord::VERSION::MAJOR \>= 4) for association ordering and source definitions.
examples/applications/typo/models · high confidence
Added new association examples for one-to-one, one-to-many, and many-to-many relationships
The examples/associations directory now includes new demonstration scenarios for various ActiveRecord association patterns. Specifically, it adds a one-to-one example using Country and HeadOfState, a one-to-many example featuring Galleons and Cannons, a direct many-to-many example with Films and Genres, and an indirect many-to-many example involving Wizards, Spells, and a SpellMastery join model. Each example provides the corresponding ActiveRecord model definitions, database schema, and configuration options to illustrate these relationship types.
examples/associations · high confidence
Added new domain and entity examples for orchards and photographs
New example files have been added to the examples/domains and examples/entities/attributes directories, introducing sample ActiveRecord models and schemas for an orchard management domain (including companies, orchards, trees, picking robots, and stands) and a photograph entity. The orchard example includes a compatibility fix for Rails 4.x ordering syntax in the recent\_trees association, ensuring the example runs correctly on both older and newer Rails versions.
examples/domains · high confidence
Added polymorphic association example
A new example in the \polymorphic-belongs-to\ directory demonstrates how to configure a \belongs\_to\ association with the \:polymorphic =\> true\ option. The example includes models for \Soldier\, \Barricade\, and \Stronghold\, where \Soldier\ belongs to a polymorphic \defensible\ target, and both \Barricade\ and \Stronghold\ have many soldiers. The accompanying schema defines the necessary tables and references to support this relationship.
examples/polymorphism · high confidence
Automatic ERD diagram generation on database migrations
Users can now run \rails generate erd:install\ to add a rake task that automatically regenerates the Entity-Relationship Diagram whenever a database migration is executed in development mode. This feature hooks into the \db:migrate\ lifecycle (including \change\, \up\, \down\, \reset\, and \redo\ actions) to invoke the ERD generation task, ensuring the diagram stays in sync with the schema without manual intervention.
lib/generators · high confidence
Initial release of Rails ERD with Mermaid default and extensive configuration options
This entry introduces the initial public version of the Rails ERD library, establishing the core API and default behavior for generating Entity-Relationship diagrams. The tool now defaults to the Mermaid generator using the erDiagram style (outputting .mmd files) instead of previous graphviz-based defaults. It provides a comprehensive set of configuration options accessible via \RailsERD.options\, allowing users to customize diagram generation through settings such as \:attributes\, \:inheritance\, \:polymorphism\, \:cluster\, \:exclude\, \:only\, and \:table\_names\. The library also includes a Rake task loader (\load\_tasks\) to automatically register generation tasks and supports loading user-wide configuration from \\~/.erdconfig\.
lib · high confidence
New Mermaid and Tbls diagram generators added alongside Graphviz
Rails ERD now supports generating diagrams in Mermaid (classDiagram and erDiagram styles) and Tbls (JSON schema) formats in addition to the existing Graphviz output. Users can generate Mermaid diagrams for use in Markdown documentation or Tbls JSON for database documentation tools, with Mermaid becoming the default generator. The Graphviz generator remains available but is now optional, requiring the ruby-graphviz gem only when explicitly selected.
_lib/rails\erd/diagram · high confidence
Refinery CMS example application models and schema added
The Refinery CMS example application now includes a complete set of ActiveRecord models (including Page, User, Image, Inquiry, and Role) and a database schema definition. These files establish the core data structures for the example, featuring validations for presence and format, associations for roles and plugins, and support for friendly IDs (slugs) to generate URL-friendly page titles.
examples/applications/refinery · high confidence
Behavioural changes
Domain model refactored with inheritance support and new attribute metadata
The domain layer has been restructured to support single-table inheritance and polymorphic associations, introducing new \Specialization\ and \NullSpecialization\/\NullGeneralized\ classes to model generalization and specialization relationships. \Entity\ now distinguishes between concrete and abstract models, allowing abstract classes to be included in the domain to prevent errors when they have associations. \Attribute\ has been enhanced to display both precision and scale for decimal columns, support \native\_types\ and \table\_names\ options for label customization, and mark primary, foreign, and unique keys in the diagram output. Additionally, the \Attribute\ class now supports sorting attributes by name and prepending the primary key to the attribute list.
_lib/rails\erd/domain · high confidence
New HTML and Record diagram node templates with orientation support
The ERD diagram generation now includes new templates for rendering node shapes in HTML and Record formats. These templates support a horizontal orientation option, allowing users to control the layout direction of the generated diagrams. The HTML template renders entities as styled tables with bold headers and italicized attribute descriptions, while the Record template provides a simpler text-based representation.
_lib/rails\erd/diagram/templates · high confidence
Rails ERD 2.2.0: Mermaid as default generator with new CLI and configuration options
Rails ERD has been updated to version 2.2.0, making Mermaid the default diagram generator (replacing Graphviz) and introducing a new \--mermaid\_style\ option to choose between \classdiagram\ and \erdiagram\ layouts. The CLI and configuration system now support a wider range of options, including \--only\_attributes\ and \--exclude\_attributes\ for fine-grained control over displayed model fields, \--inheritance\ to show single-table inheritance, \--polymorphism\ for polymorphic associations, and \--cluster\ to group models by namespace. The tool also adds support for SolidQueue models, allows custom diagram titles via \--title\, and provides better handling of configuration files and environment loading.
_lib/rails\erd · high confidence
Rails ERD v2.2.0 release with Mermaid defaults and new filtering options
This release updates the gem to version 2.2.0, introducing new configuration options \only\_attributes\ and \recursive\ to control model attribute visibility and self-referential relationships. It also adds glob and regex pattern support for the \exclude\ and \only\ filters, allowing users to filter models by namespace or pattern. The default generator is now Mermaid (using \erDiagram\ style) instead of Graphviz, producing \.mmd\ files by default, while Graphviz remains optional for PDF/PNG output. Bug fixes ensure Mermaid edges are only drawn between existing entities and that filtered models do not leak into diagrams. Internal changes include replacing \pry-nav\ with \pry-byebug\ and removing the \ostruct\ dependency.
(repo-wide) · high confidence
Refactor relationship cardinality into a dedicated inner class
The logic for determining relationship cardinality (e.g., one-to-one, one-to-many) has been extracted from the general Relationship class into a new, dedicated \Cardinality\ inner class within the \Domain::Relationship\ namespace. This change introduces explicit support for source and destination ranges, allowing the system to accurately represent optional associations (where a side is not mandatory) and correctly normalize many-to-one relationships into one-to-many. Users will see more precise structural analysis of their models, particularly regarding optional foreign keys and polymorphic associations, as the domain now explicitly tracks these cardinality constraints rather than inferring them implicitly.
_lib/rails\erd/domain/relationship · high confidence
Updated examples directory with new configuration files and generation scripts
The examples directory has been restructured to include a README explaining the contents, along with new example configuration files (erdconfig.example, erdconfig.another\_example) demonstrating options like attribute filtering and font settings. A new generate.rb script allows users to regenerate domain diagrams from example models, now supporting Mermaid output in addition to Graphviz. Additionally, identity.rb and sfdp.rb scripts have been added to demonstrate domain model reconstruction and force-directed layout generation respectively.
examples · high confidence
Test coverage
Added unit tests for ERD generation components and configuration; Establishes test infrastructure and helper utilities.
Dependencies
Add support for Rails 7.0 through 8.0 and edge versions
New Gemfile variants have been added to support testing and development against Rails 7.0.x, 7.1.x, 7.2.x, 8.0.x, and the Rails edge (main branch). These files configure the appropriate ActiveRecord gem versions and include necessary development dependencies like Mocha, Rake, and YARD, along with platform-specific gems for Ruby and JRuby environments.
gemfiles · high confidence
Rails ERD now requires Ruby 3.1+ and Rails 7.0+ with updated development tooling
The rails-erd gem has been updated to require Ruby 3.1 or higher and Rails 7.0 (ActiveRecord/ActiveSupport) as runtime dependencies, dropping support for older versions. The default diagram generator is now Mermaid, which removes the external Graphviz dependency for standard usage, while ruby-graphviz remains an optional development dependency for users who specifically need the Graphviz generator. Development tooling has been refreshed to use minitest \~\> 5.20, pry-byebug (replacing pry-nav), and updated versions of rake, yard, and sqlite3.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 75 → 73 (-2.8)
- Rubric changed (rubric-2026.09.8 → rubric-2026.09.16) — scores are not directly comparable.
Lenses
- Code Health 100 → 100 (+0.0)
- Architecture 100 → 73 (-26.6)
- Maturity 64 → 64 (+0.0)
- Readiness 72 → 74 (+2.0)
- Security 95 → 96 (+1.4)
- Domain Modelling 100 → 100 (+0.0)
Resolved (3)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Off-boarding risk: anonymized user #1
New (2)
- Off-boarding risk: anonymized user #1
- Projects may be oversized for their cohesion
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
voormedia/rails-erd was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 28 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 8ce4dd1a2e31d7abe538b7db5da492b8da9029d2 — the exact code this score is about.
- Scored under rubric-2026.09.16 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-2d9048c36d26.