# Require works in ruby not in eruby

**URL:** <https://www.ruby-forum.com/t/require-works-in-ruby-not-in-eruby/150773>\
**Category:** Ruby\
**Created:** [October 13, 2008, 5:32am UTC](https://www.ruby-forum.com/t/require-works-in-ruby-not-in-eruby/150773 "2008-10-13T05:32:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![omgitsads](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/dbc845/32.png) [@omgitsads](https://www.ruby-forum.com/u/omgitsads)\
**Post date:** [October 13, 2008, 5:32am UTC](https://www.ruby-forum.com/t/require-works-in-ruby-not-in-eruby/150773/1 "2008-10-13T05:32:19Z")

</div>

Hello,

I am loading a .rb file from and .rhtml (using an absolute path)and the  
.rb file loads fine but then it requires another file (using relative  
path) require ‘sdl’. I am running apache2 and what is especially strange  
is that if I run the url of the .rb file I am requiring in the brower  
the server executes the script fine but when I load it from the .rhtml  
file it gives me an error. I have printed the load path and it contains  
the directory for the file sdl.rb and I have also tried ‘sdl.rb’ and it  
does not work however it will load if I put the absolute path (require  
'/path to file/sdl.rb). The problem with this besides being annoying is  
that the file sdl.rb requires a bunch of other files using relative  
paths. The problem seems to be that eruby which executes within the  
.rhtml file is not loading the same relative paths as ruby however if i  
print $: in embedded ruby within the same .rhtml file it clearly states  
the correct directoy the file is located in.

The following code is in the file ruby.conf which allows embedded ruby  
on the server

`
  AddType text/html .rhtml
  
  RubyRequire apache/ruby-run
  RubyRequire apache/eruby-run
Execute *.rbx files as Ruby scripts
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance

Handle *.rhtml files as eRuby files
<Files *.rhtml>
SetHandler ruby-object
RubyHandler Apache::ERubyRun.instance

`

Ive spent hours looking through forums and posts and nothing helps  
require ‘rubygems’ does nothing. I will be returning to this post  
frequently in the next few days if you need me to post anymore  
information just ask.

Any help is appreciated!!Thanks
