开发者

Need help to upgrade my rails version

I am new to Ruby on Rails. I need to upgrade my rails version from 1.2.3 to 2.3.5.I am working in the windows environment with mysql database.Could you please help me开发者_开发百科 with the steps involved to upgrade the rails version clearly.

Thank you


As you said that you want to upgrade the rails version of the current application you have to follow few steps:

Before this just check the following settings:

  1. Check the environment.rb settings
  2. Migrate .rhtml files over to html.erb
  3. Check any routes.rb changes that might need to be made given that ROR 2.3.4 has simplified specifying the routes
  4. Make sure you have a good SCM system at hand Eg: git,svn, (or) even cvs. so that small incremental changes can be captured.

  5. Should check for the compatibility of plugins

  6. Update any form_tag entries for example <%= form_tag :action=> "search" %> becomes <% form_tag :action=>"search" do %>

  7. Like wise change <%= end_form_tag %> to <% end %>.

Once you are done with the above settings follow the instructions which mentioned below:

  1. First we have to upgrade rails by the following command

    $ sudo gem install rails

  2. Since rails:freeze:gems in 1.2.3 is not compatible with RubyGems 1.3.1 (GemRunner issue) and since it doesn't know about activeresource, we'll use a fresh Rails 2.3.4 for checking out the sources:

    $ cd ~/src $ rails rails23-app $ cd rails23-app $ rake rails:freeze:gems

  3. Create a branch for the upgrade

    $ cd ~/src/app_to_upgrade $ git checkout -b rails23 # Assumes your app is in Git

  4. Upgrade the Rails source

    $ rm -rf vendor/rails $ mv ~/src/rails23-app/vendor/rails vendor

  5. Upgrade config/boot.rb and public/javascripts/*. Rename application.rb to application_controller.rb

    $ rake rails:update

  6. Get the config/initializers/* files. Make sure the session settings are right for your app.

    $ cp -r ~/src/rails23-app/config/initializers config

  7. Make sure your config/environment.rb and config/environments/* files are Rails 2.3 compatible. Do this by comparing your versions of the files with the ones in rails23-app

Do not use config.time_zone = 'UTC' unless your database datetime columns are in UTC

You want to keep your environment.rb file fairly small by breaking parts out into config/initializers/* files.

ActionMailer::Base.server_settings has been renamed to ActionMailer::Base.smtp_settings

  1. Remove/upgrade/patch any plugins that your app has that may not be Rails 2.3 compatible. Some stuff has been moved out of Rails and into plugins and then you'll have to install those plugins. For pagination I recommend will_paginate (http://github.com/mislav/will_paginate/tree/master)

  2. Review any patches that you have made to Rails.

  3. Make your tests Rails 2.3 compatible:

  4. Commit your branch in Git, merge it to master, and deploy.

Now you can Try .

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜