Code Shop

A bit of Ruby, a bit of JavaScript, a bit of love...

    • Edit
    • Delete
    • Autopost

    Upgrading from Rails 1.2.3 to Rails 2.3.3

    I was upgrading a Rails 1.2.3 app to Rails 2.3.3 and I thought about documenting what I had to do for future reference. I was following Peter Marklund's article to upgrade to Rails 2.3.2 which I also followed to upgrade. However, I want to cover the many little things that will make your app not work in 2.3.

    Upgrading to Rails 2.3.2 should be straightforward.

    1. Modify config/enviornment.rb and change the following: 
      RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
    2. Delete vendor/rails
    3. Run:
      rake rails:freeze:edge RELEASE=2.3.3
      and
      rake rails:update
      . This should place a new version of rails. From here on follow Marklund's article to finish off the rest of the solution.

    The main differences between Rails 1.2 and 2 are the many deprecated calls that need to be addressed. Here knowing sed is a godsend. A command like the following

    find  app/ -exec sed -i '' 's/A/B/g' {} \; -print

    where A is the search and B is the replace works wonders.

    Here are some common changes that need to be addressed in transitioning and need to be replaced for your app to work.

     s/@request/request/g
     s/redirect_to_url/redirect_to/g
     s/find_first/first/g
     s/find_all/all/g
     


    Also, Rails 1.2 allowed the use of non-Restful urls which I must say are a bitch to fix if they were hardcoded. But that is the state of life...

    Tags » rails upgrading
    • 23 July 2009
    • Views
    • 0 Comments
    • Permalink
    • Favorited 0 Times
    • Tweet

    Comments 0 Comments

    Leave a Comment

  • Abhi Yerra's Posterous

    An entity composed of reality and pseudo-reality. Enjoys coding, news, history, photography.

  • About Abhi Yerra

    An entity composed of reality and pseudo-reality. Enjoys coding, news, history, photography.

  • Subscribe

    Subscribe to this posterous
    Unsubscribe
    Follow this posterous RSS
  • Follow Me

             

Theme created for Posterous by Obox