Last Updated: February 25, 2016
·
3.574K
· barnabyalter

Bringing up a Rails 2.3.5 application on Ruby 1.8.7 with RVM

I would always first recommend upgrading to Rails 3 on Ruby 1.9.x (or Rails 4 on Ruby 2 for you bleeding edgers), but if there is a case where you absolutely need the 2.3.x/1.8.7 mix, my headaches might help spare yours.

Get Ruby 1.8.7

After installing RVM, install the older version of Ruby

rvm install 1.8.7-p352 --verify-downloads 1

Use this Ruby version with rvm use 1.8.7-p352 or rvm rvmrc to .ruby-version. The latter is if you already have a Ruby environment setup with a .rvmrc file.

Downgrade your RubyGems

It's always a bad sign when you see the word "downgrade" but there are so many incompatibilities between the newest RubyGems (which will come with a new install of RVM and whatever Ruby) and Rails 2.3.5. So, to bypass a series of errors claiming no such methods exist, downgrade!

gem update --system 1.3.5

RubyGems 1.3.5 was a safe bet for me because I had the app working with this version on another server. You may have to fish for your specific version, but the 1.3.x package seems to solve most of these issues.

This downgrade alone worked for me but you may also have to delete the newer RubyGems version if your app is still having compatibility issues (sudo gem uninstall -v '{VERSION_NO}' rubygems-update).

Uninstall bundler

The error I encountered which led me to Google was uninitialized constant Gem::Installer::ENV_PATHS and this post led me to uninstalling bundler. To uninstall bundler run:

rvm @global do gem uninstall -ax rubygems-bundler

Note that this will effect your global Ruby installation, so you probably don't want to host newer Ruby apps on the same server.

Install Passenger

gem install passenger -v=3.0.8

And set it up.

Install other requisite gems

You should be all set now to install all your requisite gems and get the app running. If you are lucky enough to have a running server with this app from which you can mirror the gem settings, do that; the newest gem versions will likely cause all sorts of problems.

If you were a meticulous programmer back before bundler and set up all your config.gem lines in your Rails environments, good for you this is going to be very easy.

For the rest of us, cut your losses and upgrade all your apps ASAP.