Bypassing rack version error using Rails 2.3.5

后端 未结 9 1806
既然无缘
既然无缘 2020-12-05 21:33

I\'m currently on Dreamhost attempting to run a Rails 2.3.5 app.

Here is the situation, Dreamhost\'s servers have Rails 2.2.2 installed. Of course, I can\'t update a

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 22:06

    Dreamhost has addressed this issue on their support wiki now.

    http://wiki.dreamhost.com/Ruby_on_Rails#Rails_2.3.5_-_Rack_1.0_already_activated_.28fix.29

    From that page:

    When using Rails 2.3.5 you will get a problem from Passenger saying Rack 1.0.1 cannot be loaded because Rack 1.0 is already activated.

    One way to solve this is by freezing Rails and unpack the Rack gem into vendor/gems/rack-1.0.1

    Once Rails and Rack are in the vendor/rails and vendor/gems/rack-1.0.1 you must modify action_controller in file: vendor/rails/actionpack/lib/action_controller.rb

    In line numbers 34 and 35 must be commented out and add the following to load rack from vendor/gems

       load "#{RAILS_ROOT}/vendor/gems/rack-1.0.1/lib/rack.rb"
    

    The end result should look something like this:

       #gem 'rack', '~> 1.0.1'
       #require 'rack'
       load "#{RAILS_ROOT}/vendor/gems/rack-1.0.1/lib/rack.rb"
    

    The real problem is that Passenger already loads Rack 1.0 and I believe Passenger must load 1.0.1 in order for this hack to go away.

提交回复
热议问题