These are the steps I followed while upgrading 2 of my rails applications. One of them was developed with Rails 1.2.2 and the other was 1.2.3. They are not complicated apps, so my job here was easy. If you have a sophisticated application you may need to work a little bit harder.
First of all, backup your rails app, in case something bad happens!
Backup your database.
Dive into your old applicaiton and remove all session files.
Update RAILS_GEM_VERSION
in your config/environment.rb file.
Update your rails app.
Install necessary plugins. With Rails 2.x some integrated features turned to plugins such as acts_as tree, acts_as_list..
Add secret key to your config/environment.rb file.
Install classic_pagination
plugin if you used pagination in your application. The official source for this plugin should be svn://errtheblog.com/svn/plugins/classic_pagination
. However, this url is unreachable. So we are going to try another workaround to install it.
Find and replace all find_all
with find(:all)
. To find out:
If you used start_form_tag
and end_form_tag
in you app, you should add 2 methods to application helper. If you don’t want to add these 2 methods, then you should convert your forms to code block. Check out this google group discussion for more info.
I’ve realized that I didn’t use RAILS_ROOT
in my application while setting file or directory paths. Rails 1.2.x version didn’t complain about that, however, Rails 2.x complains about not finding directory paths. I solved this issue by using RAILS_ROOT
while creating directory or file paths. If you have file uploads in your application, I suggest you look over your codes.
Show time! Start your application server and test with your browser. I know you run Firefox
This is how I managed to work my old rails app work in Rails 2.1.2. They are not very complicated apps, so it was easy to switch to Rails 2.1.2. If you want to add something to my list please be my guest. Thanks!