I came across RailRoad today on another blog. Very cool idea. When I had done some work in the past, I found it hard to remember class names and method names. I’m used to a Java IDE like IDEA to do name completion, but that largely doesn’t exist for the Ruby world, or it may be available now. Generating diagrams from your code should help things a lot.
RailRoad is a diagram generator for Ruby on Rails applications. Actually, it’s a simple Ruby script that loads the application classes and analyzes its properties (attributes, methods) and relationships (inheritance, model associations like has_many, etc.) The output is a graph description in the DOT language, suitable to be handled with tools like Graphviz.
RailRoad can produce:
* Model diagrams, showing both inheritance hierarchy and models associations. You can choose to show the model “content columns” and its types.
* Controller diagrams, showing inheritance hierarchy. You can include the controllers’ methods, grouped by its visibility (public, protected, private.)