The underlying cause of this is Rails 2.3's feature of allowing external gems to provide connection adapters, rather than having them all bundled. The gory details are in activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb
if you're interested, but the long and the short of it is that the first thing that establish_connection will try to do is load a gem, and if that fails to do a "traditional" require (which will load the built-in mysql adapter).
Signalling the "failure" is done by raising LoadError
, and here's where things get annoying. Rubygems has it's own LoadError
class (Gem::LoadError
) and I think this is where the problem is coming from, in that activerecord isn't properly detecting that the (expected) failure has occured, and so is bombing out instead of just trying to load the connection adapter locally.
Bodgy back that you'll probably regret doing in the future is to change activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb
line 72 to:
rescue LoadError, Gem::LoadError
The proper way of fixing this is to work out what's gone wrong in your environment to cause this (since it obviously doesn't break for everyone). My first guesses would be that you're running an old version of RubyGems (line 578 of rubygems.rb in version 1.3.3 has nothing to do with load errors, for example), or a strange (possibly out-of-date) version of Ruby. I'd make sure you're running an up-to-date Rubygems (Rails 2.3 requires at least 1.3.1 to run right, which I'm thinking might be what you're hitting) and that your Ruby version isn't too out there (use 1.8.6 or 1.8.7, and I'd be wary of using 1.9 in your situation).
If you're running all that OK and the problem persists, give full and complete details of your system (OS, distro, source of Ruby/rubygems (package, from source, etc), versions of all the above, any customisations) and someone can run the problem to ground. As it stands you've given no information that helps anyone to help track the problem down.