Musings about Entrepreneurship, Technology and Software Development

Accidental Technologist

  • Home
  • About
  • Still River Software
  • Privacy Policy

Dead Simple Model Diagrams for Your Rails Project

Tweet

While working on Rails project I often find myself wanting a visual representation of my model classes. ?I usually grab a notebook and manually write them out. Depending on the project, it can take time.

I started searching for a diagramming tool that might be easier and faster than writing out by hand, there are a bunch of them out there. ?Most have a steep learning curve and are expensive.

A bit of searching around the web for a Ruby-specific tool lead me to a gem named rails-erd. ?Maybe you have heard of it, maybe I’m the last to know, but regardless it is a nice find.

Installing

The gem relies on GraphViz to do it’s drawing magic. ?There are a multitude of ways to install it, I used Homebrew:

brew install graphviz

Add the gem to your development group in your Gemfile:

group :development do
?gem 'rails-erd'
end

Don’t forget to run the bundle command.

When everything is install, from the root of your Rails project simple run:

rake erd

When the rake task runs, watch the output from the tool. It tells you items you won’t find on the diagram either because it’s not used or a relationship isn’t right.

The Output

The result will be a PDF file in the root of your project that looks something like this:?

Erd

As you can see, it gives a very nice model diagram with all the relations and properties. Just what I was looking for.

The tool is very customizable and the web site outlines everything that can be changed. ?I haven’t looked very much at this aspect since it produced everything I needed the first time.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

May 9, 2013 Posted in Ruby on Rails Tagged With: diagrams, domain models, erd, models, Ruby on Rails

Popular Posts

  • 10 Alternative Ruby Web Frameworks
  • 7 Resources Every JavaScript Developer Should Know
  • Setting up SQLite3 for Ruby on Rails Development
  • Running Rails 3 on Windows
Micro.blog

Categories

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Latest Tweets

  • RT @dhh: Away CEO apologies for past bad behavior, then continues the abuse in the afternoon. How incompetent do you have to… https://t.co/LEIoyv7hy1

    1 day ago
  • Amazon is really screwing up with their deliveries this holiday season. As a Prime member I usually get shipments i… https://t.co/ihyf16Yyc4

    1 day ago
  • Reading @Avdi’s tweets about trying to get a tech job are depressing. It’s sad the process doesn’t respect the cand… https://t.co/Zkt9vBh9cL

    1 day ago
  • After upgrading to iPadOS, my iPad Pro gets terrible battery life. Come on @Apple, get your act together.

    2 days ago
  • RT @scottw: Tailwind CSS - Next to Rails no other library, tool, framework has done more to make it easier to ship new things t… https://t.co/MXMo3hVAfZ

    5 days ago

Tags

Agile amazon Android Apple App Store ASP.NET MVC book bootstrapping Business conference Customer Service Droid X email entrepreneurship functional programming Google InfoQ InstantRails iOS iPad iPhone JavaScript mac microconf Microsoft mixergy mobile objective-c Open Source podcast rails Rails3 railsconf RSS Ruby Ruby on Rails scala sinatra Software swift twitter Windows WordPress WPEngine xcode

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2019 · Genesis Minimal Notebook on Genesis Framework · WordPress · Log in

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.