1. Skip to navigation
  2. Skip to content

The ELC Community Blog

A knowledge exchange on Ruby on Rails and Agile Development


A room hung with pictures is a room hung with thoughts

by doram on September 24, 2007
If like me, it helps to have a picture of the persistent data in your app, then you might want to try one of the following rails plugins:

Rails Application Visualizer (RAV)

The first option I tried; Rails Application Visualizer works in conjunction with GraphViz to produce pictures of your models.

1. Install GraphViz

$ sudo port install graphviz

2. Check out RAV into your plugins directory:

$ cd $RAILS_ROOT/vendor/plugins
$ svn co svn://rubyforge.org/var/svn/rav/stable rav

3. Download, and apply the patch to ignore abstract, and non-db models (Optional step):

$ cd $RAILS_ROOT/vendor/plugins/rav
$ curl http://rubyforge.org/tracker/download.php/1332/5243/14087/2537/cope_with_abstract_and_non_db_models.patch > cope_with_abstract_and_non_db_models.patch
$ patch -p0 < ./cope_with_abstract_and_non_db_models.patch

4. Generate a diagram of your Models:

To produce a png file with your model objects type:
$ cd $RAILS_ROOT
$ rake visualize CONTROLLERS=no

RailRoad

The second option is RailRoad, which has more features than RAV. Like RAV it also uses GraphViz to handle the graph rendering.

1. Install GraphViz

(see above)

2. Get the RailRoad gem

$ gem install -y railroad

3. Generate a diagram of your Models:

To generate a high level overview of your models with no attributes type:
$ railroad -b -M | dot -Tpdf > models.pdf
Enjoy!

Comments

Dave Oram at 3:40 AM on September 28 2007

To exclude some classes from your diagram use:

railroad -e model.rb,model2.rb -M | dot -Tpdf > models.pdf

Add a comment


home | services | Ruby on Rails Development | code | blog | company