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.

Migrations

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
end

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.

Getting a head start on IE7

With all the posts starting to pop up about IE7 being layout complete and waving the starting flag that it’s okay to start testing, I downloaded it from MSDN yesterday and took it for a spin. I found some good instructions for how to run IE7 on the same machine as IE6. I can’t run them at the same time since when IE7 is loaded, it uses a registry entry which causes IE6 to open URL’s in my default browser, which is Firefox. The instructions include a batch file for creating and cleaning this up when you run IE7.

I went to a handful of sites and assuming you have a standards-based site using CSS for presentation, I think the biggest problem most of you are going to face is with clearing floats. At least it will for me. I’ve made a lot of use of the easy clearing method and this won’t work in a lot of cases for IE7. Maybe if I wait long enough it will get updated so I can keep using it. I haven’t yet tried this update to that method yet.

My initial efforts

I just finished fixing up the first site I think I ever did without using tables. The Bailey Foundation site had some issues with a few floats in IE7. I added a few empty markup elements and a couple of “zoom:1;” attributes to the CSS in a few places to make IE7 happy. I then had to deal with some things that broke in IE6, which then broke things in Firefox. I seem to have gotten it all balanced out though. After that I checked things out in Safari and it seemed good, too.

On my own site, the main two issues I found where that the nav area wasn’t clearing the floated elements in the nav bar and I had the same problem on my portfolio page with the body. Adding a few

empty tags to the markup fixed both issues, but I consider it just a quick fix since I don’t like to add the extra markup.

What did I learn?

For sites I do from here on out and most likely with others I fix, I think the safest route will be to use IE’s conditional comments to load in browser specific css files like this:

-[if lt IE 7]>
   
->

At least we have something to test with now.

SXSW 2006 Recap

SXSW was awesome and I can’t imagine it being any better, which exceptions noted below…

I didn’t bother with day-to-day updates. There are plenty of those to go around. While I do have some pics, you’ll find a whole lot of those on Flickr.

For me, it was about getting the chance to meet and hang out with a lot of people I’ve followed for a while online and have a great deal of admiration for. If you are in web design or web development at all, you should attempt to make it next year.

The key to having the best time at SXSW is to be social. While there are a few great panels, most could be better. It’s at the parties and social events and bars where you’ll get the most out of the entire experience.

The exception mentioned above was my night out with Garrett Dimon, Dan Rubin and Matthew Oliphant who’s evening just went from about as good as it could get, to almost as bad as it could. Check out his recap of the evening.

Regardless, it was an incredible time. I’m now energized to get back to work and looking forward to SXSW 2007 already.

Departing for my first SXSW

Later today, I’ll be headed down for SXSW Interactive. From what I hear I expect it to be a blast. I hope to see a lot of people, learn a lot of things, drink a lot of beer and mostly have fun.

Yahoo! releases their UI Library

I’m just beginning to dive into this, but it’s got me excited. They’ve got two versions of each source file, a build one with all the comments and a src which is already compressed for you.

Having worked for a while with Prototype and Script.aculo.us I’m curious to see how they compare. Seems like Script.aculo.us provides a lot of whiz bang effects the Yahoo library doesn’t have, but you do have all of these:

  • animation
  • calendar (not sure if there’s a dropdown version)
  • connection (ajax stuff)
  • dom
  • dragdrop
  • event
  • slider
  • treeview (particularly cool)

My biggest issue about it so far is that you’d have to type the namespace of YAHOO about a zillion times. Typing

Yahoo.util.Dom.get('myelement');

is a lot more typing than prototype’s terse

$('myelement')

More Articles

Page 7 of 9 » ‹ First  < 5 6 7 8 9 >