Have you ever wanted to visually represent your Rails schema in a way that is clear and shows the various relationships between models? I’ve been asked for a visual representation of our schema several times now by various departments here at CoachUp.
After creating the diagram, we actually found that it was extremely helpful to all members on the dev team (especially new members whom we were on-boarding)
I figured this would be a great quick blog post in the event that anyone else out there needs to do the same thing. Here are the steps I took to produce a quality diagram of our Rails model data using the Railroady Gem:
Install the railroady gem:
Install graphviz to get the dot and neat utilities:
brew install graphviz
Add the railroady gem to your bundle:
group :development, :test do gem 'railroady' end
Run bundle install to install railroady:
Run from the command line:
railroady -o models.dot -M
Then process the .dot file as an image, and voila!