title: Why relative path doesn't work in Ruby require
body: <p>I'm starting learning Ruby, one thing that I don't understand, why relative path for require directive doesn't work in ruby. It's something that works almost in every scripting language that I now (JSP, PHP...). I explain with a real example. I have a folder named <strong>shapes</strong> which contains 3 classes <strong>shape</strong>, <strong>rectangle</strong> and <strong>square</strong>. I have also another file test_shapes.rb from where I call and test my classes. When I import my classes to the main file like this:</p>
  
  <pre><code>require "./shape"
  require "./rectangle"
  require "./square"
  </code></pre>
  
  <p>I got error for files not found. When I include the name of my subfolder like this:</p>
  
  <pre><code>require "./shapes/shape"
  require "./shapes/rectangle"
  require "./shapes/square"
  </code></pre>
  
  <p>The code is perfectly working. Because I specified the whole path to the root directory of the project (the lib folder I think). When I include I include the absolute path to the hard disk, like this: </p>
  
  <pre><code>require "#{File.dirname(__FILE__)}/shape"
  require "#{File.dirname(__FILE__)}/rectangle"
  require "#{File.dirname(__FILE__)}/square"
  </code></pre>
  
  <p>It's also working perfectly.</p>
  
  <p>So, I just want some explanation if know why the first import method (the relative path to the current folder) in not working.</p>