require works in ruby not in eruby

A

Adam Hurlburt

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

<code>
AddType text/html .rhtml

<IfModule mod_ruby.c>
RubyRequire apache/ruby-run
RubyRequire apache/eruby-run

# Execute *.rbx files as Ruby scripts
<Files *.rbx>
SetHandler ruby-object
RubyHandler Apache::RubyRun.instance
</Files>

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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top