百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rails-mermaid_erd

> 后端框架
开源

从您的 Ruby on Rails 应用程序生成 Mermaid ERD。

180 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

从您的 Ruby on Rails 应用程序生成 Mermaid ERD。

English | 日本語 | 简体中文 | 繁體中文 | 한국어 | Español | Français | Deutsch | Italiano | Português (Brasil) | Русский | العربية

Rails Mermaid ERD

Generate Mermaid ERD from your Ruby on Rails application.

Demo Page

Mermaid ERD can be generated at will. The generated ERD can be copied in Markdown format, so they can be easily shared on GitHub. You can also save it as an image, so it can be used in environments where Mermaid is not available. The editor is a single HTML file, so the entire editor can be shared.

Installation

Add this line to your application's Gemfile:

ruby
gem "rails-mermaid_erd", group: :development, require: false

And then execute:

bash
$ bundle install

Add this line to your application's Rakefile:

ruby
begin
  require "rails-mermaid_erd"
rescue LoadError
  # Do nothing.
end

Usage

Run rake task mermaid_erd will generate /mermaid_erd/index.html.

bash
$ bundle exec rails mermaid_erd
# or
$ bundle exec rake mermaid_erd

Simply open the generated /mermaid_erd/index.html in your browser.

This file is not required for Git management, so you can add it to .gitignore if necessary

mermaid_erd

/mermaid_erd/index.html is a single self-contained HTML file. All front-end dependencies (Tailwind, Mermaid, Vue) are inlined, so it works offline and behind strict corporate proxies — no CDN access is needed at view time. The file is roughly 4 MB because the bundles ship inside it.

If you share this file, it can be used by those who do not have a Ruby on Rails environment. Or, you can upload the file to a web server and share it with the same URL.

It would be very smart to generate it automatically using CI.

Print the Mermaid source to stdout

Run rake task mermaid_erd:print to print the raw erDiagram source to stdout instead of writing the HTML viewer. This pipes cleanly into other tools:

bash
$ bundle exec rails mermaid_erd:print
$ bundle exec rails mermaid_erd:print > er.mmd
$ bundle exec rails mermaid_erd:print | mmdc -i - -o er.svg

The output is the full diagram — every table, column, key, comment, and relation — equivalent to the HTML viewer with all of its detail toggles enabled.

Languages

The viewer UI ships in 12 languages: English, 日本語, 简体中文, 繁體中文, 한국어, Español, Français, Deutsch, Italiano, Português (Brasil), Русский, and العربية (right-to-left). It auto-detects the browser language (navigator.language) on load, falls back to English for unsupported locales, and can be switched manually from the selector in the top-right corner.

Supported versions

The Ruby × Rails combinations exercised by CI on every push and pull request:

Rails Ruby
5.2 2.7
6.0 2.7, 3.0
6.1 2.7, 3.0, 3.1, 3.2
7.0 2.7, 3.0, 3.1, 3.2, 3.3
7.1 3.1, 3.2, 3.3, 3.4
7.2 3.1, 3.2, 3.3, 3.4
8.0 3.2, 3.3, 3.4, 4.0
8.1 3.2, 3.3, 3.4, 4.0

Other combinations may work but are not verified.

Configuration

./config/mermaid_erd.yml to customize the configuration. See ./docs/example.yml for an example configuration.

The setting items are as follows.

key description default
result_path Destination of generated files. mermaid_erd/index.html
ignore_tables Array of regular-expression strings. Tables whose table_name matches any pattern are dropped from the generated ERD, along with any relations that point at them. Useful for excluding audit-log models, soft-deleted/legacy tables, or other large noise you don't want to render. Patterns are compiled with Regexp.new, so escape backslashes inside YAML strings (e.g. "\\Aaudit_"). []

License

The gem is available as open source under the terms of the MIT License.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubydiagramerdgemmermaid

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架