22

I'm beginning to learn Ruby on Rails, and looking at other peoples code. Is there any way to take an exisiting codebase and create object relationship diagrams or Entity relationship diagrams (ERD's) ?

I know Visio can do some things given a database, but I was hoping to produce diagrams of classes and objects.

4 Answers 4

25

Also Rails ERD is not bad. It is a bit simpler than Railroad but it is still a great project.

0
19

You may want to check out Railroad. It takes your Rails project and visualizes it. It can create diagrams based off of your models (based off of has_many, has_and_belongs_to_many, etc), controllers (based on inheritance hierarchy) and state machine diagrams, which I have never used.

But it is pretty cool and does what it is supposed to. It may not have all the flair that Visio has but it is a darn good solution.

3
  • 13
    Railroad didn't work for me with Rails 3, there is however this plugin which works fine: github.com/voormedia/rails-erd
    – rdvdijk
    Sep 20, 2010 at 9:27
  • 1
    I wish I could upvote rdvddijk's comment - Railroad is pretty old now. Rails ERD however takes only seconds to install and works great. Aug 18, 2011 at 17:43
  • 1
    As Railroad is not working with ruby 1.9.2 and rails 3.0.10 you can use Railroady instead as I learned in this other SO post: stackoverflow.com/questions/7624457/… Feb 27, 2013 at 14:16
3

Some IDE's have this feature, if I remember rightly RubyMine does.

2

Rails ERD has excellent documentation and gallery: http://rails-erd.rubyforge.org/gallery.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.