Starting my first big Ruby on Rails app

I’ve settled into a new project and I’m excited that I’ll be using Ruby on Rails to develop it. With the recent release of Rails v1.1, it seems to be a great time to start. I’m going to try to stay on a weekly schedule during development. Hopefully I’ll hit upon most of the issues someone has when they’re initially getting into Rails and I’ll be able to provide some helpful information.

What am I building?

First off, while I would have loved to just dive into the code and start building things, this project turned out to not be the best to do that with. I started by building out wireframes. The main reason was that I was building off of someone else’s vision and the wireframes offered a way to learn what that was very quickly and also provided our designer the same information and something he could build a design from. It took roughly three days and I now feel I know what I need to do.

wireframesI created the wireframes using Visio with the templates and stencils available at Garrett Dimon’s site. Using these will save you a whole lot of time if you need to build some wireframes. I would use Omnigraffle on Mac OSX, but I’m just more familiar with Visio.

Sketching the database

ERD sketchOnce I had a better understanding of the site, I went to work on the tables I’d need in the database. I generally use pen and paper initially to draw out the tables I think I’ll need along with the relationships. When this is ready to become more finalized, I then go back to Visio to create an ERD diagram and start adding fields. Again, my familiarity with Visio is why I chose it. If anyone has recommendations on a good ERD tool for OSX, I’d be interested in checking it out.

ERD in visio with hand written notesMy intent with the ERD is not to create a living, breathing document connected to the database. I’d love that, but it’s more about quickly coming up with a starting point to get into creating Rails migrations and creating the models. You’ll notice some handwritten notes, too. These were pointing out things I missed which then get updated in the document.


If you’re not familiar with Migrations, here’s a good rundown on it. You can get further information on the Rails wiki UsingMigrations page. Basically, they allow you a nice method for updating and rolling back changes to the database. You can also add and alter data, as well.

This was straightforward for the most part, the only part I had to research was in creating some join tables in a has_and_belongs_to_many relationship. These tables don’t need an id field and the create_table function adds it by default. There’s an :id option you can set to false to suppress it. Here’s an example:

create_table :messages_images, :id => false do |t|
   t.column :message_id, :integer, :null => false
   t.column :image_id, :integer, :null =>false

Next steps

Building out the language of the application with unit tests and models. From the first Dallas Ruby Brigade meeting, Adam Keyes mentioned that he starts his Rails apps by creating his models, which defines the language he’ll use in the rest of his application. This made a lot of sense to me so that’s the approach I’ll be taking.

Commenting has expired for this post.