
So why would you want to use require_relative over require? While require relies on the directories loaded in $:, therequire_allgem allows you to execute code from other files without having to shovel in directories beforehand. The general rule of thumb is require should be used for external files, like gems, while require_relative should be used for referring to files within your directory. Though you can call on absolute paths using both methods, but require_relative's scope is wider and is aware of the entire directory where the program resides. Technically, require could be called on to work like require_relative: