6 Nerd-Its - +

Visualize Ruby on Rails Model Associations with rails_assviz

Page_white_text an academic article by Mark A. McBride (markmcb), published on 21 June 2009
tagged as rails, graphviz, visualization, model, and railsassviz
other nerds have left 2 comments below

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.

2_article_2756_thumb_dot_erd

OmniNerd’s model associations.

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.

Notes

1 rails_assviz is available on github. http://github.com/markmcb/rails_assviz/tree/master

Thread parent sort order:
Thread verbosity:

I needed something like this about a year ago, and a web search turned up RailRoad, which generates “dot” format files from Rails models.

OmniNerd Article Propagation

The Showcase

Nerd-Its   Nerd Trends   Last Ten  

  1. RE: Skipping Vista in Finally, the Death of Microsoft Internet Explorer 6?
  2. RE: Dawkins' (Scottb's) Unanswered Questions in God before Country in the Military
  3. RE: Look--etchings! in God before Country in the Military
  4. RE: Look--etchings! in God before Country in the Military
  5. RE: Dawkins' (Scottb's) Unanswered Questions in God before Country in the Military
  6. RE: Still true? in God before Country in the Military
  7. Still true? in God before Country in the Military
  8. Athletic Excellence in spite of Hardship in Winter Olympic sports?
  9. All it requires is that good men do nothing. in Scientology: We've had it with you
  10. RE: Dawkins' (Scottb's) Unanswered Questions in God before Country in the Military

What is OmniNerd?

Omninerd_icon Welcome! OmniNerd's content is generated by nerds like you. Learn more.

Voting Booth

Winter Olympic sports?

17 votes, 9 comments