Trouble Freezing Rails

I have a Rails app that is currently running in production on Rails
v1.2.2. Since I didn’t have control of the server that runs the
production copy of this app, I have put off upgrading to v2.x.
However, I recently read about freezing Rails to your app, making it
independent of the version of Rails installed on the server so I
upgraded my app to v2.3.4. On my development machine everything
worked great after freezing Rails to my upgraded app, (presumably
because I have Rails v2.3.4 installed locally). As a test of the
freezing process, I copied my frozen app to an old PC that only has
Rails v2.0.2 installed and tried starting up a Mongrel server . This
is unsuccessful, and causes the following error…

E:/Ruby/lib/ruby/site_ruby/1.8/rubygem.rb:246: in ‘activate’: can’t
activate actionpack (= 2.0.2), already activated actionpack-2.3.4]
(Gem::Exception)

If I go to the gems directory on this box and rename the
actionpack-2.0.2 directory (such as adding a -) and try starting
mongrel again I get a similar error message…

E:/Ruby/lib/ruby/site_ruby/1.8/rubygem.rb:246: in ‘activate’: can’t
activate rails (= 2.0.2), already activated rails-2.3.4]
(Gem::Exception)

I checked my controllers for includes that might be causing this, but
nothing seemed suspicious (only includes were for ‘date’, ‘net/http’,
and ‘uri’) Any help with this would be greatly appreciated. Freezing
seemed so straightforward, don’t know why it’s causing me so many
problems.

Thanks for any nuggets of insight / wisdom that come my way…

If you post the rest of the backtrace, it will be much more helpful.
The activation is coming from somewhere, so the trace will show
that.

–Matt J.

Thanks for the reply Matt,

Unfortunately, I cannot post more of the backtrace because I am unable
to reproduce the same error now that I have made progress on this
problem. I did the following on the machine with Rails 2.0.2 on it
and all works well there now.

-updated rubygems from 0.9.4 to 1.3.5 and updated all gems that
rubygems-update-1.3.5 depends on (builder, session, hoe-seattlerb,
minitest, hoe)
-installed rack gem 1.0.1

My next hurdle is to attempt freezing all of these gems and forcing
rubygems-update to be loaded on my production app. I was thinking of
doing this by adding a ‘require’ into dispatch.fcgi but I’m not sure
if this is wise or if it’ll even work at all.

Of course I welcome any advice anyone has…

If you don’t control the server and the Rubygems version is old,
you’re pretty much out of luck. The only way around it is to compile a
new Ruby and Rubygems from source and tell your app to use that.
You’ll probably want to check with whoever does control the server
about the availability of the compiler toolchain before trying that
(on Site5, they needed to add you to a special “compiler” group, for
instance).

–Matt J.