I’ve recently tasked myself with performing a major upgrade for Webster’s Classroom. It includes both a complete site redesign and an upgrade to the latest version of Rails. We all know its a bit of a pain to upgrade from Rails 2 to Rails 3 but the longer you put off the upgrade the more painful it becomes. The app was written as a proof of concept many years ago and despite its growing user base it doesn’t have a strong enough foundation to allow it to continue expanding. We build it too quick and sloppy years ago and as a result we are testless and in need of major refactoring.
I’ve upgraded a handful of apps to Rails 3 from Rails 2 already and in the past I’ve started off trying to upgrade within the current code base. I’ve had numerous problems with this approach and unless you’re really meticulous on every single file, you’re going to end up with a bunch of old junk files laying around and likely some missing new ones that you’ll want. This time I’ve taken a different approach and started off with a fresh default Rails 3.1 install and began moving over the legacy code file by file. I’m happy with taking this approach and instead of trying to take my Rails 2 code and upgrade it to Rails 3. Starting with a fresh Rails 3.1 code base and moving over code where it needs to be has given me the chance to move things into places they ought to be like moving code outside of the environment configs and into initializers. If I had just tried to upgrade the old code inline, I wouldn’t have spent the same amount of attention on cleaning up that mess. Once this upgrade it deployable, Webster’s Classroom is going to be in a position to really expand dramatically and rapidly.