Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I upgrade a Rails app to use the latest version of Rails

I'm working on a Rails app that currently uses Rails 1.2, so I'm now quite a long way behind the latest stable release (Rails 2.3).

How should I go about the process of moving to a newer version of Rails?

Should I upgrade one point release at a time or straight to Rails 2.3?

How do I find out what has changed between versions of Rails, both

  • improvements or new features that give me more reasons to upgrade
  • Rails changes that will require me to modify my app before it will work with the new version.

(I have seen this question on the mechanics of upgrading, but I'm more interested in the process I should go through to make the upgrade as painless as possible.)

like image 425
David Waller Avatar asked Jan 24 '23 16:01

David Waller


2 Answers

I went through this a few months back, did a lot of research and put together a rake task (based on someone else's script plus additional resources) that might help you in flagging things to change in your code. This was for upgrading to Rails 2.2 so it doesn't take into account Rails 2.3 changes:

http://gist.github.com/99535

Oh, be sure to check that the plugins and gems you use are Rails 2.x compatible and use the latest versions.

And I definitely agree with upgrading directly to Rails 2.3 in one go. And don't keep putting it off; the longer you go without upgrading, the more difficult it will be as more will have changed. And it's harder to maintaing Rails 1.x code as there are less resources that support it.

like image 172
insane.dreamer Avatar answered Jan 26 '23 06:01

insane.dreamer


My advice is to spend a week paying down any testing debt you've accumulated, and then do the upgrade all in one fell swoop.

Where I work we upgraded a very large app from 1.2 to 2.0.2 last summer, and at the same time upgraded to Ruby 1.8.6.

It took MUCH longer than expected. The app used a couple of old features that were removed or deprecated (like ActionWebService), so converting those took some time. But mostly we ran into a lot of subtle bugs, like slight differences in how radio button params work, some of which were attributable to the Ruby (vs. the Rails) upgrade.

Some parts of the app had spotty test coverage. If we had gone into it with better tests it all would have been much easier.

like image 42
Sarah Mei Avatar answered Jan 26 '23 07:01

Sarah Mei