Use gem rails-erd to generate Entity-Relationship-Diagrams (ERD) from your Rails app

Usage #

  1. Add the gem to Gemfile
    gem 'rails-erd', group: :development
    
  2. Install graphviz dependency in the console
    sudo apt-get install graphviz
    
  3. Now when you run
    bundle exec erd
    

It will generate erd.pdf in the root folder of your Rails app.

Here are some examples of what it can look like:

rails-erd-pdf

Advanced usage #

You can also create an .erdconfig file in the root folder and add some configs