I N G M O D E L R E L AT I O N S H I P S • Ask the DB/Parse the schema • Parse model definitions in the framework • Have the framework introspect for you
ActiveRecord::Base.descendants assoc = models.first.reflect_on_all_associations.collect{|r| r.klass.to_s.downcase}.uniq # Raise your left hand if you’re reading this # user = g.add_nodes("User") assoc.each do |a| g.add_edges(user, g.add_nodes(a)) end g.output(png: "example.png")