简体   繁体   中英

How to upgrade rails app from 2.2.2 to 2.3.11?

I have installed rails.2.3.11 and run rake rails:upgrade.

Do i need to modify anymore files ?

Steps for upgrading Rails 2.2.2 to 2.3.11.

  1. rails install -v=2.3.11

  2. modify config/environment.rb

     RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION 
  3. run rake task => rake rails:update # Update configs, scripts and javascripts

    This rake task will modify some of the files.

  4. modify config/environment.rb

    Replace

     config.action_controller.session = { :session_key => '_name_session', :secret => 'asdfasfasfafafafadaseerweewr' } 

    with

     config.action_controller.session = { :key => '_name_session', :secret => 'asdfasfasfafafafadaseerweewr' } 
  5. modify app/controllers/application_controller.rb

    Replace

     session :session_key => '_intrado_session_id' 

    with

     #session :session_key => '_intrado_session_id' 
  6. Replace

     session.session_id 

    with

     request.session_options[:id] 

May be this will help...

EDIT:

Rails 2.3.11 + Rack 1.0.0 + Phusion Passenger 2.0.6 causing problem 500 internal server error undefined method 'rewind' to solve that issue.

I have installed.

  1. sudo gem install rack -v=1.1.1

  2. sudo gem install passenger -v=2.2.8

  3. passenger-install-apache2-module

It would prompt you to replace few lines in /etc/httpd/conf/httpd.conf with the following at the end of installation of the 3nd step

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.8/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.8
PassengerRuby /usr/local/bin/ruby

This file would already have above three lines. So, it would be sufficient to replace 2.0.6 with 2.2.8.

After performing the above steps, restart apache2 and restart rails by the following commands.

  1. sudo /etc/init.d/http.d restart
  2. cd /var/www/project_name
  3. sudo touch tmp/restart.txt

Do not replace session.session_id with request.session_options[:id] .

It will lead to 500 internal server error

I got undefined local variable or method `request' for # , when I replaced session.session_id with request.session_options[:id] .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM