Generating Entity-Relationship Diagram for Ruby on Rails

Install graphviz (if not yet)
linux sudo apt-get install graphviz
osx brew install graphviz

Add the gem

In the project gemfile add

group :development do
  gem 'rails-erd'

Then execute cd PATH_OF_THE_PROJECT && bundle install

Using it
It's as simple as a bundle exec rake erd and it will generate a PDF file in the root of the app.