Auto-Generated ER Diagrams of Popular Rails Projects
I discovered yUML.me today. It’s a really awesome project and allows you to hotlink UML class, activity or use-case diagrams on any page. All of the UML data is in the URL itself, so it’s real easy to embed these images anywhere without JS or API’s. I’ve always wanted to use YARD to generate ER diagrams programmatically, and I figured this would be a great way to test out the service.
Since I don’t write many Rails apps, I figured I’d select some of the most popular open source rails apps out there and generate ER diagrams for those. It turned out to be an interesting exercise in visualizing database structures of some of the projects people use day to day.
The projects I chose were: Instiki, Gemcutter, Seed, Radiant, Mephisto, Insoshi and Spree. The results range from awesome to scary, but you can judge for yourselves.
Results
Instiki
Nice and simple. Maybe too simple?
![][11]
Gemcutter
Here’s a nice one. Sufficiently complex but still easy to follow. I should point out at this point that dashed lines refer to has-many-through relationships (with the attr name as the arrow label.
Seed
This is probably the cleanest one. The use of STI in the models really makes this look nice.
Radiant
Simple, but those recursive relationships look a little messy, don’t they? I guess it would look better if the layout was done right. Note that those labels again refer to the attribute name.
Mephisto
Manageable.
Insoshi
Now we’re getting crazy. yUML is starting to fail on us.
Click the image to see the madness
Spree
This one isn’t exactly fair. I think the amount of complexity here is a little out of the scope of a single UML diagram. It’s fun to look at, though.
Click the image to see the madness
How?
All of these diagrams were generated automatically with a simple YARD handler and piped into yUML. The code is on gist:
[11]: http://yuml.me/diagram/scruffy/class/[Web]++-*[Page],[Web]++-*[WikiFile],[Web]++-*[Revision],[Page]++-*[Revision],[Page]++-*[WikiReference],[Page]1--Current Revision-1[Revision]