开发者

Upgrade Rails App From 1.2.3 to 3.1.0?

开发者 https://www.devze.com 2023-04-12 21:56 出处:网络
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.

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


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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号