I was just wondering where shall I put my new table in my rails model. And I was thinking “wouldn’t it be nice to have an ER diagram?”. Ok, actually I was thinking “damn, how can I graph my tables?”.
So I did a little research and ended up with a pretty basic AND pretty nice solution. It uses graphiviz. I’ve used this before on another project, so I knew it’s nice and easy, and there’s even loads of configuration possibilities, if I would want to go for that.
So basically it was just 2 steps:
I found a script to generate a graphviz input file at Matt Biddulph’s blog. So first thing I did was to create a new file in my rails root directory, I called it graph_models.rb, pasted Matt’s code and excuted it on command line. Easy.
Next thing, I didn’t want to install Graphviz. I just want an ER diagram. Quick. So I googled and found an online service done by T.Ashitani. There I pasted the code I got from Matt’s script.
And voila. I got my ER Diagram. :-)


