Gem 1.5 with Rails 2.3 5

Posted by arunagw on March 19, 2011

You may fall down into the situation where you don’t have RVM and your system gem is upgraded for using latest things.

And your old application is still running on older version of rails.

This is just a workaround of using Gem > 1.3.7 in Rails 2.3 Applications.

I have tested this solution with Rails 2.3.5 and different version of gems.

After upgrading gems to 1.6.2 i have got an error

/activesupport-2.3.5/lib/active_support/dependencies.rb:55: 
uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)

To fix this error need to update boot.rb file. Place this at the top of boot.rb

require 'thread'

After adding this you should be getting this error

 
/gem_dependency.rb:119:in
 `requirement': undefined local variable or method `version_requirements'

To fix this error you need update your environment.rb file.
Add this code above your Rails::Initializer.run block.

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.3.7')
 module Rails
   class GemDependency
     def requirement
       r = super
       (r == Gem::Requirement.default) ? nil : r
     end
   end
 end
end

Now your application should start running properly. Have fun ;)

Now you can downgrade or upgrade your system gem version. Your application will still run.

Above workaround works for me very well. Any other ideas?

Trackbacks

Use this link to trackback from your own site.

  • http://ivanenviroman.com ivanoats

    Also, add in require ‘thread’ to script/server if you still see an error.

  • Cserb

    fixed it for me, thanks!

  • Tincho

    gracias!!!! muy util, solucione el problema

  • Satvat Rani7

    I fixed it,but errors are occur
            from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-2.
    3.5/lib/active_support/dependencies.rb:156:in `require’
            from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-2.
    3.5/lib/active_support/dependencies.rb:521:in `new_constants_in’
            from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/activesupport-2.
    3.5/lib/active_support/dependencies.rb:156:in `require’
            from C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/
    commands/server.rb:84
            from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_
    require.rb:36:in `gem_original_require’
            from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_
    require.rb:36:in `require’
            from script/server:3

  • Satvat Rani

    The environment that i am working on is Windows xp and the configurations are,

    Ruby 1.8.7 [i386-mingw32]

    Rails 2.3.5

    Gem 1.8.17

     
    anyone tell me the solution…thks in advance


Follow

Get every new post delivered to your Inbox

Join other followers