• Troubleshooting a Slow Production Deployment

    October 21, 2010 at 6:55 AM
    This is part of a series on Rails 2 Upgrade Turbulence . Staging and testing a big release is important, but there are some factors that can only be obsereved in the true production environment. Sure, I can replay the most interesting 80% of a yesterday's traffic against a test server without it failing – but I'm onl...
  • git-svn workflow warts

    October 21, 2010 at 6:23 AM
    This is part of a series on Rails 2 Upgrade Turbulence . Now that I had confidence that the code was production-ready, it was time to merge changes back into trunk. We still have a main SVN repository, although most people use the git-svn bridge. This proved problematic in three ways which have nothing to do with Rails wha...
  • ActiveRecord woes

    October 21, 2010 at 6:02 AM
    This is part of a series on Rails 2 Upgrade Turbulence . ActiveRecord associations have changed. There are some gotchas, at least compared to the Rails 1.1.6 frame of mind. Join v. Queries Instead of forcing a join against the tables for every incuded association, ActiveRecord is now smart enough to split things into separ...
  • Disabling Sessions

    October 21, 2010 at 5:45 AM
    This is part of a series on Rails 2 Upgrade Turbulence . Urbanspoon uses sessions to store various bits of information in the database that users might want to see again. We have a neat hack that Adam wrote to turn off sessions for bots so that we don't need to touch that table unless necessary. Unfortunately, his trick de...
  • General Cleanup

    October 21, 2010 at 5:31 AM
    This is part of a series on Rails 2 Upgrade Turbulence . Some generic cleanup tasks: @request/@params/etc are deprecated, drop the '@' everywhere. application.rb becomes application_controller.rb start_form_tag and end_form_tag are deprecated; use form_for instead. ActiveRecord associations have changed . Named routing has...
  • Bulk-loading associations with ActiveRecord

    September 13, 2010 at 10:55 AM
    Here's a fairly common problem I've encountered. Say you have two classes; for example, a Restaurant and a Cuisine. They exist in a many-to-many relationship, and have associations defined like so: class Restaurant :delete_all has_many :cuisines, :through => :restaurant_cuisines end class Cuisine :delete_all has_many :rest...
  • Reinvent the Wheel

    August 14, 2010 at 3:19 PM
    I spent a few days of last week pursuing a novel activity: building a bicycle wheel. I followed Sheldon Brown's excellent wheelbuiding guide , and I've been quite pleased with the results. Thus far the wheel has been smooth and true, and I feel rather enlightened by the whole experience. This marked a milestone of sorts in...