Planet Urf

Blogging a dead horse

0 notes &

Getting a Rail 2.3.5 app to play nicely with the latest RubyGems

The app that I spend much of my day working on is, for one reason or another, still on Rails 2.3.5. I’d been avoiding doing the updates to RubyGems specifically because of this. However, a recent refresh of my MacBook meant that I took the plunge and upgraded.

The first issue I hit was the “uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)” one. This was easily fixed by chucking the following at the top of config/boot.rb: -

require "thread"

- thanks to this StackOverflow post for the info :)

The next issue was the “undefined local variable or method ‘version_requirements’ (NameError)” one, which was equally easily fixed by adding the following into environment.rb between the bootstrapper and the initializer (sic): -

if Gem::VERSION >= "1.3.6"
 
module Rails
   
class GemDependency
     
def requirement
        r
= super
       
(r == Gem::Requirement.default) ? nil : r
     
end
   
end
 
end
end

- thanks to Martin Straub for the info on this one.