Topic: UML Modeling

Right now is there a UML modeling tool that will generate my design for RoR apps?

Re: UML Modeling

I'm not sure where I picked this up but this creates some kind of graph displaying your model's relationships by looking in the code.  It's about the closest I've seen to what you're talking about.

#!/usr/bin/env ruby

# USAGE:
# ./model_graph.rb | dot -Tps | ps2pdf - > models.pdf

require "config/environment"
Dir.glob("app/models/*rb") { |f|
    require f
}
puts "digraph x {"
Dir.glob("app/models/*rb") { |f|
    f.match(/\/([a-z_]+).rb/)
    classname = $1.camelize
    klass = Kernel.const_get classname
    if klass.superclass == ActiveRecord::Base
        puts classname
        klass.reflect_on_all_associations.each { |a|
            puts classname + " -> " + a.name.to_s.camelize.singularize + " [label="+a.macro.to_s+"]"
        }
    end
}
puts "}"