Load mongo fail

Hi

I have installed mongo gem firstly, but when I require ‘mongo’ it get
failed:

irb(main):001:0> require ‘rubygems’
=> true
irb(main):002:0> require ‘mongo’
NameError: uninitialized constant Mongo
from ./mongo.rb:5
from
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in
gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:inrequire’
from (irb):2

This is my ruby and gem version:

$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]
$ gem -v
1.8.10

Please help, thank you.

On Mon, Aug 29, 2011 at 2:45 AM, zuerrong [email protected] wrote:

   from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in

$ gem -v
1.8.10

Please help, thank you.

You’re using an old version of Ruby that leaves the current directory in
the
load path. This means that when you type require "mongo", it is not
requiring the mongo gem, instead it is requiring your local file. Look
at
the first line of the backtrace “from ./mongo.rb:5” The path to that
file is
./mongo.rb, it’s in your current directory. Obviously that file
references
Mongo on line 5, probably expecting that you’d already required the
gem.

Oh thank you, that’s really the problem.
I have a ruby file named “mongo.rb” in the current dir, so irb try
load that file firstly.
Thanks for the point.

Regards.

2011/8/29 Josh C. [email protected]: