How to survive Rails upgrade

In my case, I’m using many instances of Rails. And in this mean upgrades are not always done simultaneously. Of course, rails can be installed with many different versions on single machine. But first You have to inform Rails to use proper version. Since I’ve come to Rails via 4 Days on Rails (rails.homelinux.org) I did placed in environment.rb given directives (require_gem), but to my surprise WEBrick didn’t event started with application giving errors similar to:

/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:149:in `activate’: can’t activate activesupport (= 1.2.5), already activated activesupport-1.3.0] (Gem::Exception)

I though that approach presented in 4 Days and in more detail on RoR Wiki – wiki.rubyonrails.com/rails/pages/HowtoLockToSpecificRailsVersions should be OK. But to my surprise, was not.

After putting code from Wiki in my environment.rb I still got can’t activate… I don’t know why, but using google I found hint which helped me to skip this obstacle. In rails application is vendor sub directory. I suppose (this is why I could go further) require first is looking in local lib and vendor directories, so checking out proper version of Rails there will do the trick. So You need go to Your application root directory and run (I was upgrading from Rails 1.0.0 to 1.1.0 so I needed copy 1.0.0, YMMV) :

svn export http://dev.rubyonrails.org/svn/rails/tags/rel_1-0-0/ vendor/rails

This looks like ugly hack, since locking versions in environment.rb should work. I need to investigate it a bit more. Stay tuned ;-)

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.