From: Jeremy Bopp Date: 2011-01-08T13:19:15+09:00 Subject: Re: Ruby load path On 01/07/2011 02:26 PM, Bharat Ruparel wrote: > This works for my rack application: > > $: << File.expand_path(File.dirname(__FILE__)) > > require "some_file" > .... > > However if I comment this out the first line, i.e. > > # $: << File.expand_path(File.dirname(__FILE__)) > > then the file some_file.rb cannot be found and web-server (mongrel) > complains. > > How can I adjust the path at the system level where I don't have to put > the line: > > $: << File.expand_path(File.dirname(__FILE__)) > > at the top of each ruby file that requires some other ruby file? I don't know much about Rack applications, but it sounds like you might be using Ruby 1.9. If so, have you tried replacing your problematic require calls with require_relative? You might also look to the configuration of the HTTP server hosting your Rack application and see if you can set the RUBYLIB environment variable to include the path to the directory containing some_file. Hopefully, someone with actual experience using Rack can provide better help. -Jeremy