Saturday, December 20, 2008

Changes from Rails 1.2.3 to Rails 2.2.2

After a long time we have changed one of our project from Rails 1.2.3 to Rails 2.2.2 .
Steps to follow for migrating.

1. Get the latest Instant Rails
2. gem install rails (This will get the latest version (now its 2.2.2))
3. gem update --system (This will update your gems)
4. rake rails:freeze:edge (This will freeze your application to the new version. This will require svn installed)

Later start the server, then you will definitely face some problems with your old application.

The problems(with solutions) I faced while migrating are,

1. Error: undefined method `cache_template_extensions=' for ActionView::Base:Class

When you try to start the server, you will get this error.
cache_template_extensions is deprecated. so you need to remove config.action_view.cache_template_extensions = false in config/environments/development.rb

2.
*******************************************************************
* config.breakpoint_server has been deprecated and has no effect. *
*******************************************************************

This warning will appear, you need to remove config.breakpoint_server = true in development.rb

3. NameError: uninitialized constant Inflector
This will appear if your environment.rb or any other place including your old plugins consisits of
Inflector.inflections do |inflect|

end
This is actually deprecated. If you find any of these issues in plugins kindly update your plugins with your latest versions.

4. NameError: uninitialized constant Rails::Plugin::Dependencies
This will come if you use any old gems, Actually Dependencies are deprecated to ActiveSupport::Dependencies, so you can change this in your code.

These are the main issues i found while starting the server. But after starting the server you will find so many issues to fix. You need to fix them accordingly with Rails 2.2.2.