You can refactor this if block so that it happens as the first line:

    raise "Code needs update for new Rails version" unless Rails.version.to_f == 3.2

and then you don't need any of the other if blocks in the file.