tags:

views:

60

answers:

2

I have a folder full of ruby files, and when I try and require one file in another that is in the same directory using require 'file' I get a LoadError but when I use require './file' everything works fine. Can somebody explain to me why this happens and if there is any way I can require a file without adding a ./ onto the file?

(Picture of directory): alt text

+1  A: 

You don't have current directory in your loadpath.

Check the contents of the $LOAD_PATH variable

glebm
+1  A: 

If you want to require a file not from the system $LOAD_PATH but rather relative to the directory of the file you are requireing from, you should use require_relative. (Which, as you can see, isn't exactly extensively documented.)

Jörg W Mittag