Question

I have several Rails applications with version 2.3.8, which I run using the thin server. I want to install Rails 3.0.1 on the same machine for testing purposes.

The installation worked fine, but after installing Rails 3.0.1, running Rails 2.3.8 applications with thin fails with this error:

>> Using rails adapter
Missing the Rails 2.3.8 gem. Please `gem install -v=2.3.8 rails`,
update your RAILS_GEM_VERSION setting in config/environment.rb for
the Rails version you do have installed, or comment out RAILS_GEM_VERSION
to use the latest version installed.

There seems to be a problem with the latest version of rack (1.2.1) installed with Rails 3. If I uninstall rack 1.2.1 and keep only rack 1.1.0, my Rails 2.3.8 applications run with no problem.

Specifying the rack version with config.gem in environment.rb doesn't solve the problem. Unpacking the rack 1.1.0 gem in the vendor/gems directory doesn't change anything either.

With rack 1.2.1, I can't start my Rails 2.3.8 applications. Without rack 1.2.1, I can't start my Rails 3.0.1 applications.

All the solutions I've found online are about unpacking the rack gem, but this doesn't seem to work for me. Is there something else I should be doing?

Was it helpful?

Solution 3

I did manage to run both Rails versions by installing Ruby twice in separate locations.

If anyone finds a way to run with only one Ruby though, I'd be interested to know.

OTHER TIPS

I have just Ruby 1.9.2p0 installed using RVM system wide and I run apps using Rails 3 & 2.3.10 on the same server using Thin.

You have to setup bundler on your rails 2.3.10 apps (http://gembundler.com/rails23.html).

Here's one of my Gemfiles for a Rails 2.3.10 app. It's important to specify the rack version.

source :gemcutter
gem "rack", "~> 1.1.0"
gem "rails", "~> 2.3.10"
gem "will_paginate", "~> 2.3.15"
gem 'haml'
gem 'mysql2'
gem 'authlogic'
gem 'searchlogic'
gem 'paperclip'
gem 'thin'

For Rails 2.3.10 you have to start thin from in the app directory using:

bundle exec thin start <options here>

If you are using RVM and are trying to start apps from an init script read this: RVM and thin, root vs. local user

Had the same issue with a Rails 2.3.5 app and Thin (1.2.7). Had to:

gem uninstall rack --version 1.2.1
gem uninstall rack --version 1.1.0

that left me with only version 1.0.1 and then it worked fine.

Like you, I'm going to be in a mess trying to transition an app into Rails 3. One solution is to use rvm (which I already am) and its notion of gemsets which provide isolation for specific gems for specific applications. I've not played with those yet.

Hopefully the 'thin' folks will get this sorted out.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top