error message 'undefined method `require_gem' for main:Object (NoMethodError)'--how to resolve?

I'm getting the following when doing a db:migrate after installing RoR 2+:

Macintosh-4:ui Ken$ rake db:migrate /usr/local/bin/rake:17: undefined method `require_gem' for main:Object (NoMethodError)

I have done a ' sudo gem update --system'. Any thoughts as to what might be causing this?

This is on OS X 10.5

Thanks, Ken

I'm getting the following when doing a db:migrate after installing RoR
2+:

Macintosh-4:ui Ken$ rake db:migrate /usr/local/bin/rake:17: undefined method `require_gem' for main:Object
(NoMethodError)

I have done a ' sudo gem update --system'. Any thoughts as to what
might be causing this?

Your app was written for an old version of rubygems. require_gem was deprecated a while back (replaced with gem) and eventually removed. If you've just updated your app to a new version of rails, then running rake rails:update will update things like boot.rb which may have been using require_gem

Fred

require_gem 'gemname'

is now to

require 'rubygems' require 'gemname'

This is how you convert.

Heh, rake rails:update gives the same error. Sigh. Advice much
appreciated, though.

Apparently I have an old lib of some sort hanging around that needs to
be updated, but I don't know how to find out what it is, let alone do the update. I am
running rails 2.x.

Thanks, Ken

Unfortunately, it's not my code that's causing the problem, and I
don't know what is out of date that I need to update. This all started when I upgraded to RoR 2.x (with
dependencies). I can't do anything about the code that's in there, except try to figure out how to upgrade whatever
is using this call.

Thanks, Ken

'rake' itself is a gem.

Can you try

sudo gem update rake

?

Heh, rake rails:update gives the same error. Sigh. Advice much appreciated, though.

Ah well you'll just have to fix the files yourself. replace
occurrences of require_gem with gem

Fred

The error was obvious from the error message, once I looked at it
closely; I needed to 'gem install rake' :slight_smile:

Thanks, Ken