Rails is a nice framework because it does its best to keep things simple. However, even the simplest framework can get cumbersome as an application grows. As I was tweaking some of the Rails code that powers OmniNerd, I was wishing I had a simple command line script that would draw a picture of OmniNerd’s model associations for me. Well, I wished for about 5 minutes and then I fired up TextMate and got to writing. The image you see is the result.
Each line or “edge” between nodes calls out a relation between two “models.” In Rails, models define various objects that ultimately get stored in a database. As you can see, there are a lot of associations.
The cool thing about this script is that it’s insanely useful and only took about 60 lines of “real” code (and about 100 lines of “housekeeping” code). I put the code on github and gave it the name rails_assviz. 1 The name just came to me. Rails associations … assviz. It’s perfect.
If you hack on Ruby, feel free to send me input on how to make this better. For now, it serves my needs. Hopefully someone else will find it useful as well.
1 rails_assviz is available on github. http://github.com/markmcb/rails_assviz/tree/master
Similarly tagged OmniNerd content:
- Amazing Radio Control, by Occams 7 months ago
- Automating Data Visualization with Ruby and Graphviz, by markmcb over 4 years ago
- Striking a Balance Between Convention and Performance, by markmcb over 4 years ago