Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Mar 2009 12:33:47 -0400
From:      Bill Moran <>
To:        John Almberg <>
Subject:   Re: links vs real directories
Message-ID:  <>
In-Reply-To: <>
References:  <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
In response to John Almberg <>:
> A little more information on this... from the Rails log, I can see  
> that a Ruby script in the config directory cannot load ('require') a  
> needed file because it can't find it:
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in  
> `gem_original_require': no such file to load -- application  
> (MissingSource     File)
> It looks like this require statement is using a relative path, like  
> '../path/to/file'. Does '..' not work properly with a soft link? In  
> other words, '..', should mean ~/app, but since the config directory  
> is really in '~/shared', perhaps '..' translates to '~/shared'? That  
> would cause the problem finding the file.

That's a common problem with soft links and interpreted languages.

> Is there a way around this problem?

Generally, you have to fix this in the application itself.  I'm not a
Ruby expert, but I can list some of the methods that solve the problem
in PHP:

1 If Ruby has a config value for including library files (often called a
  "search path"), configure it  to the correct paths and tell Ruby to
  include the file name with the configured path information.
2 Write a wrapper around the requirement function that normalizes the path
  so that it works.
3 Ditch the softlink altogether and require files by absolute path.

The first one is probably the most desirable, although I've had good
success using PHP's __autoload() to accomplish #2.  Don't know if there's
an equivalent in Ruby.

In any event, if you're explicitly including files by relative path, you'll
have to stop doing that.  It's a bad idea in any event.

Bill Moran

Want to link to this message? Use this URL: <>