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