
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Arerd is a Ruby gem that extracts Entity-Relationship (ER) information from your ActiveRecord models and generates clear, visual ER diagrams in Mermaid format.
Once integrated into your Rails project, Arerd provides a convenient Rake task (db:erd:mermaid
or db:erd:markdown
) that outputs a Mermaid-formatted ER diagram directly to your terminal.
You can also automate ER diagram generation in your CI pipeline by outputting the diagram in Markdown format. This ensures your ER diagram documentation is always up to date and easy to maintain.
Add Arerd to your Rails application's Gemfile:
gem "arerd"
Then install the gem:
bundle install
Run the following command to create a Mermaid ER diagram:
bin/rails db:erd:mermaid
This will output the diagram in Mermaid's erDiagram
format to standard output. You can copy and paste the result into the Mermaid Live Editor or any Mermaid-compatible tool to visualize your ER diagram.
To output the ER diagram in Markdown format:
bin/rails db:erd:markdown
This command prints the diagram wrapped in triple backticks and tagged as mermaid
, allowing you to preview it directly in supported Markdown editors or viewers.
Table and column names in diagrams are automatically translated using your Rails application's locale files. Arerd leverages Rails' I18n system to provide localized names for entities and attributes, making diagrams more accessible for international teams.
inverse_of
option.has_many :through
are ignored.belongs_to :taggable, polymorphic: true
) are not supported.erDiagram
User["User (ユーザー)"] {
integer id PK "Id"
string name UK "名前 (indexed)"
datetime created_at "作成日時"
datetime updated_at "更新日時"
}
Profile["Profile (プロフィール)"] {
integer id PK "Id"
integer user_id FK "ユーザーID (indexed)"
string bio "自己紹介 (nullable)"
datetime created_at "作成日時"
datetime updated_at "更新日時"
}
Post["Post (投稿)"] {
integer id PK "Id"
string title "タイトル"
text body "本文"
integer user_id FK "ユーザーID (indexed)"
datetime created_at "作成日時"
datetime updated_at "更新日時"
}
Notification["Notification (通知)"] {
integer id PK "Id"
integer user_id FK "ユーザーID (indexed)"
integer sender_id FK "送信者ID (nullable, indexed)"
string message "メッセージ"
datetime created_at "作成日時"
datetime updated_at "更新日時"
}
Follow["Follow (フォロー)"] {
integer id PK "Id"
integer follower_id FK "フォロワーID (indexed)"
integer followed_id UK "フォロー対象ID (indexed)"
datetime created_at "作成日時"
datetime updated_at "更新日時"
}
Community["Community (コミュニティ)"] {
integer id PK "Id"
string name "名前"
datetime created_at "作成日時"
datetime updated_at "更新日時"
}
User ||--o{ Post : "posts / user"
User ||--o| Profile : "profile / user"
User ||--o{ Follow : "follows / follower"
User ||--o{ User : "followees / followers"
User ||--o{ Follow : "reverse_follows / followee"
User ||--o{ User : "followers / followees"
User ||--o{ Notification : "notifications / user"
User |o--o{ Notification : "sent_notifications / sender"
Community }o--o{ User : "users / communities"
FAQs
Unknown package
We found that arerd demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.