Rails Entity-Relationship Diagrams
This post will look into the
rails-erd gem and how we can set it up to quickly visualize what our relationships in Rails look like.
Source code can be found here.
# Create a new rails project $ git clone https://github.com/okeeffed/demo-rails-associations.git $ cd demo-rails-associations # Add the gem $ bundle add rails-erd
After cloning the project, we just need to add the
rails-erd gem and we are basically home and hosed.
Generating the diagram
At this point, all we need to do to output a diagram is to run
bundle exec erd.
That will output a PDF file
erd.pdf. The output will outline the following from the relationships we created in the previous posts:
Today's short post demonstrated how to generate the entity-relationship diagram for the Rails models using
Resources and further reading
1,200+ PEOPLE ALREADY JOINED ❤️️
Get fresh posts + news direct to your inbox.
No spam. We only send you relevant content.