5

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....

Rubyist
  • 6,486
  • 10
  • 51
  • 86
  • I don't think there's a reasonable one-step process for this. I recommend upgrading to Rails 2 using a guide, making sure all your tests pass (and maybe give it a few days/weeks in production just in case...), then follow the upgrade guides from Rails 2 to Rails 3. – Jordan Running Oct 13 '11 at 07:23
  • @Jordan : Thanks Man. But I did not have sufficient time to follow this step. If you have any idea to upgrade this then please let me know. I will try that approach. – Rubyist Oct 13 '11 at 07:27
  • @Jordan : Do you have any reference doc for this to upgrade Rails 1 to Rails 2 version. ? If you have then Please share... Thanks – Rubyist Oct 19 '11 at 04:58
  • Thanx Man for reply. I am following this blog : http://marklunds.com/articles/one/409 Please have a look and tell your view about this blog. – Rubyist Oct 19 '11 at 05:32

3 Answers3

4

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.

bricker
  • 8,911
  • 2
  • 44
  • 54
  • Thanks Boss. Steps given by you is really fine or me. You said very well that Routing is going to kill me. – Rubyist Oct 13 '11 at 07:48
0

I have migrated a major application from 2.3.10 to 3.0.9 it's a very painful process and if I wanted to move to 3.1 it would have been even worse.

Depending on your application size, I would definitely recommend to create a new application and copy over the stuff.

Migrating from this old version of rails to the newest is definitely not in a single leap, there are so many different things to consider.

BUT, the best thing about my answer is that I DO recommend you do that, the process of testing, finding compatible gems etc... is so much nicer in rails 3 and ruby 1.9.2

KensoDev
  • 3,285
  • 21
  • 38
  • Yes Man, You are right. It is better to make new application as clone of existing project. And we can use the logic as well as few code can be re-used. Otherwise whole junk code will create trouble while execution. – Rubyist Oct 13 '11 at 07:49
0

wow, as bricker said, it's quite a leap! I used Rails 1 ages ago.. I didn't upgrade to Rails 2, I re-wrote.

How big is your Rails 1.2.3 application?

So many things have changed, features in Rails, so many Gems, Routing, Asset Pipeline, Named Scopes, the ActiveRecord Query API, ... even Ruby has changed -- it would be a bad idea to just upgrade. There are many new concepts and features, which you will have to think about, and it will be much better to start from a clean slate.

This can be a blessing in disguise. I think this is a great opportunity for you to improve your code base by re-writing and re-architecting it in Rails 3.1 :-)

I would suggest to start from scratch on the Rails 3.1 application with the most critical features, while keeping the 1.2.3 application around in maintenance mode.

It's probably also a good chance to get rid of some 'features' of your app, which are hardly ever used...

Tilo
  • 33,354
  • 5
  • 79
  • 106
  • Yes You are right. I am also thinking the same thing. Thanks for making my decision strong. – Rubyist Oct 13 '11 at 08:42
  • it might be a tough sell for your boss - just don't tell :) -- in the end s/he will be happy – Tilo Oct 13 '11 at 08:45
  • Thanks Man. My Boss know everything and Even I explained these terms to Client as well. Client is also ready for this. – Rubyist Oct 13 '11 at 10:15