Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade Rails App From 1.2.3 to 3.1.0?

I'm working on Rails 1.2.3 version. Now I want to upgrade the Rails version as well as ruy version from 1.8.6 to 1.9.7.

Is it a major pain to work with such older version but it is in running condition. Now i want advance features of Rails but not supporting this older version .

Please suggest me the way to upgrade the version and ruby version.

Thanks....

like image 985
Rubyist Avatar asked Oct 10 '22 18:10

Rubyist


1 Answers

That is quite a leap. Your best bet is to create a new rails 3.1 app and then manually migrate your code over.

gem install rails #=> will install the latest stable release from rubygems
gem install bundler
rails new myapp

The first thing you'll need to do is open up Gemfile and add in any gems you're using in your current application, and it would also be a good idea to find the gem versions of any plugins you're using (in vendor/plugins). Also make sure you have the proper gem installed for the type of database you're using (mysql2, sqlite3, or pg).

After you've added all the gems you need, run bundle install to bundle all the gems with your application.

As far as views, models, and controllers, that stuff should all be okay to just copy over to the new application. You will probably need to tweak a few things, but for the most part that stuff should all work.

You'll also need to open up config/application.rb and configure your application. You can use your old environment.rb file as a reference.

The last step before you can start your application is to change your routes.rb file to the new Rails 3 format. This is probably the worst part of migrating, as you'll first need to learn how to write a Rails 3 routing file, and then manually write in your routes. More information can be found here.

I never used Rails 1 so it's possible that you may have to change some other things. These three Railscasts will definitely be a helpful resource for you.

like image 138
bricker Avatar answered Oct 13 '22 12:10

bricker