From: Ammar Ali Date: 2010-10-07T21:11:08+09:00 Subject: Re: "Load" Works, But "Require" Doesn't? On Thu, Oct 7, 2010 at 1:37 PM, Tom Wardrop wrote: > I'm on 1.9.2. This now raises a number of questions... > > 1) How come the load() method isn't affected by this? I'm not sure, but I guess (hope someone else will chime in) it is because load needs a full file name, while require tries different extensions (.rb, .o, .so, .dl, .dyld, maybe others) potentially loading something you did not intend. > 2) What is the logic behind not allowing files to be referenced with a > relative path? Only via require, as you discovered. It's a security measure. Please see: http://redmine.ruby-lang.org/issues/show/1733 > 3) What is the correct way for referencing files relatively? The link above mentions two possible ways which are useful on the command line or from scripts (-I and RUBYLIB). You can also use __FILE__ in combination File.expand_path to require files relatively from a given file: require File.expand_path( 'some/file', __FILE__) Regards, Ammar