LAMBEAU Bernard wrote: > Well, we know that ruby 1.8.x doesn't ensure unique loading with that > kind of require ... > > There's another hack below, that should be consolidated however, > > module Kernel > alias_method :old_require, :require > def require(path) > old_require(File.expand_path(path)) > end > end Yuk, that will break any program which uses any sort of external library. irb(main):001:0> File.expand_path("net/http") => "/home/candlerb/net/http" irb(main):002:0> require File.expand_path("net/http") LoadError: no such file to load -- /home/candlerb/net/http from (irb):2:in `require' from (irb):2 from :0 irb(main):003:0> require 'net/http' => true The original question said: "In a big ruby project, how to prevent requiring a file multiple times? Like the #ifdef in C" Well, nothing stops you using the same trick in Ruby: unless defined? _FOO _FOO = 1 ... rest end But in general, as long as you use require sensibly (i.e. consistently require 'foo' and not mixed with require '/path/to/foo') then this isn't a problem. So it seems to me the OP is doing something out-of-the-ordinary which is causing the warnings (not errors) that he sees. However, since he didn't post the exact warnings seen, or the code which produces them, it's hard to help him further. -- Posted via http://www.ruby-forum.com/.