Railsのクラス関連図を出力:RailLoadプラグイン

今、モデルがたくさんあるRailsアプリを開発しています。基本的なモデリングはしてありますがメイン機能を補足するようなクラスが追加されたり関連が動いているので、RailsLoadプラグインを使ってRailsのクラス関連図を出力してみることにしました。Railsの場合has_many,belongs_to,has_oneなどで関連が定義されているのでこれを拾ってくれる仕組みなようです。注意としてはモデル間でお互いに関連記述していないと関係を取得できない模様。親だけでなく子からも指定が必要。

RaiLoad -Ruby on Rails diagrams generator-

RailRoad is a class diagrams generator for Ruby on Rails applications. It's a 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.)
State machine diagramas (for use with the "acts_as_state_machine" plugin.)