# i ran into an issue lately where i had to leave some old rails code running # while migrating to rails 2.1. the gotcha? each rails version requires a # different version of rubygems to be installed on the system and ruby doesn't # (easily) support concurrent installs of rubygems. my solution? leave the # old system in place, dump rubygems.rb and rubygems/* into RAILS_ROOT/lib and # force rails to pick it up on boot. how? put this into # RAILS_ROOT/config/preinitializer.rb # # we feature test rubygems, all old skool like autoconf - sigh. iff gems # it found to be too old we'll bootstrap from a rubygems install located # locally in our rails app, otherwise we'll let rails load rubygems from # the system in the normal dll hell fashion # outerr = `gem --version 2>&1` if $?.exitstatus == 0 major, minor, teeny = outerr.to_s.scan(%r/\d+/).map{|i| Integer i} if major and minor and teeny unless major == 1 $:.unshift File.join(RAILS_ROOT, 'lib') begin require 'rubygems' ensure $:.shift end end end end # ps. this will blow up when you run via mongrel_rails since that code goes # ahead and loads rubygems for you, totally preventing the above hack from # having a chance to work, but that's a story for another post... #