Tuesday, August 12, 2008

Upgrading to Rails 2.1

Started upgrading from Rails 1.2.6 to Rails 2.1 today.  Here's a few things we ran into:

  • Oracle adapter now known as "oracle_enhanced" rather than "oci", and can be installed via the "activerecord-oracle_enhanced-adapter" gem
  • There's a couple of config.* options that are no longer valuable and you'll be warned to delete.  They are in the specific environment file (e.g. development.rb), not environment.rb, in case you're looking for them.
  • Delete any tmp/sessions you've got lying around, and for that matter clear the session cookies in your browser as well.  Sessions are apparently different now.
  • Speaking of which, you need a key for session generation.  In your environment.rb file you'll need this:
    • config.action_controller.session = { :session_key => "_myapp_session",
              :secret=> "some random secret key of your choosing over 30 characters" }


  • gem update --system (with TWO dashes, everybody always gets a cut and paste error with that) needed to update the Gem system
  • gem update   may run into some gems that do not offer precompiled binaries (only relevant for Windows, I suppose).  I hit a wall with hpricot and ferret in particular.  So to get around the problem I uninstalled them (ignoring any dependency warnings), continued with gem update so all my other gems would update to their latest versions, then put back hpricot and ferret based on the versions I previously had.  Oh, and mongrel gave me trouble as well.
  • For some reason rake also gave me trouble because an old version was lying around with "require_gem" in it, which apparently hasn't worked for awhile.  For that I just edited rake.bat and changed it to 'gem'

Other than that, things seem to be working.  I didn't have to change my source code at all, which is a testament to the "reverse deprecation" that's been going on where in anticipation of 2.x my code has been telling me "Ok, this thing here is going away with 2.x, so stop it."  Can you imagine what the Java language would look like today if they'd taken that approach from the beginning, instead of just forever marking things deprecated and never removing them?

(I haven't touched Java in a few years, did they ever get around to removing the deprecated stuff??)

No comments: