There must be a mistake, below is the test I've made. No warning at all, even with warning level set to 2 Could you send some example? % cat test.rb require 'thedef' require 'test1' require 'test2' % cat thedef.rb THEDEF = 1 % cat test1.rb require 'thedef' % cat test2.rb require 'thedef' % ruby -W2 test.rb % blambeau On Mon, Jan 5, 2009 at 10:03 AM, Zhao Yi <youhaodeyi / gmail.com> wrote: > Phlip wrote: >> >> I don't know about all cases but I suspect the biggest culprit is >> require 'foo' >> twice with different paths. >> >> If you have a Rails project, it has a Magic Loader that automagically >> loads the >> file foo.rb if the interpreter sees a Foo reference and has not seen a >> definition for Foo yet. This is a miracle and a pain in the butt, >> because a >> subsequent require 'foo' line might not have the same path, and you get >> the >> double-require issue. >> >> That's a total hack, but it works well enough. > > But there is only one file named foo.rb, how could require 'foo' happen? > Is there a way to avoid printing the warning message? > -- > Posted via http://www.ruby-forum.com/. > >