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.

Aaron Gray
  • 11,283
  • 7
  • 55
  • 61
PaulHurleyuk
  • 8,009
  • 15
  • 54
  • 78

4 Answers4

25

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

lzap
  • 16,417
  • 12
  • 71
  • 108
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.

vrish88
  • 20,047
  • 8
  • 38
  • 56
  • 13
    Railroad didn't work for me with Rails 3, there is however this plugin which works fine: http://github.com/voormedia/rails-erd – rdvdijk Sep 20 '10 at 09: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. – Dave Smylie Aug 18 '11 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: http://stackoverflow.com/questions/7624457/railroad-is-not-working-giving-me-issues-ie-railroad-0-5-0-lib-railroad-app-di – RidingTheRails Feb 27 '13 at 14:16
3

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

Kris
  • 19,188
  • 9
  • 91
  • 111
2

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

joelparkerhenderson
  • 34,808
  • 19
  • 98
  • 119