rails-erd

Link to docs

Step 1: Install in your gemfile

You have to install it in a rails Gemfile.rb because it relies on ActiveRecord associations

gem 'rails-erd', group: :development
$ bundle install

Step 2: Profit

You can now use a rake command to visualize your model dependencies.

$ rake erd

outputs to a local file called erd.pdf

$ rake erd filename=myerd

outputs to a local file called myerd.pdf

$ rake erd orientation=vertical title='My ERD' only="User"

shows just the User model and all attributes, with the title ‘My ERD’, in a vertical orientation

$ rake erd only="User" attributes=false

shows just the User model without attributes

$ rake erd only="User,Blog" attributes=false

shows the relationship between the User model and the Blog model without any attributes

$ rake erd only="User,Blog" attributes=foreign_keys

shows the relationship between the User model and the Blog model and includes only the foreign keys


Mostly Katie explaining things to herself.

© 2022