Problem with "require"

Hi!

I'm begining with eRuby and I have a difficulty with a chunk of my code. I
have my index.rhtml wich contains a require, a .rb that is located in
Ressources/Ruby/RDForm.rb. When I run index.rhtml through eRuby, it goes
through perfectly fine but when I try to access it through Apache, I get
this error:

<-- Error -->
[Sat Oct 23 18:31:18 2004] [error] mod_ruby:
/home/http/godsiocorp/index.rhtml:8: uninitialized constant
#<Module:0x4120f22c>::RDForm (NameError)
[Sat Oct 23 18:31:18 2004] [error] mod_ruby: from (eval):117
[Sat Oct 23 18:31:18 2004] [error] mod_ruby: from
/usr/lib/ruby/1.8/apache/eruby-run.rb:116:in `eval_string_wrap'
[Sat Oct 23 18:31:18 2004] [error] mod_ruby: from
/usr/lib/ruby/1.8/apache/eruby-run.rb:116:in `run'
[Sat Oct 23 18:31:18 2004] [error] mod_ruby: from
/usr/lib/ruby/1.8/apache/eruby-run.rb:72:in `handler'

Here is the chunk in index.rhtml that causes some problems :

<-- index.rhtml -->
<%
       #Requires
       require 'Ressources/Ruby/RDForm'

       #begin
               form = RDForm.new("mainForm", "main", "POST", "index.rhtml")

%>

And RDForm.rb looks like that (in part)

<-- RDForm.rb -->
require 'Ressources/Ruby/RDIncludes.rb'

class RDForm
  
  def initialize(m_id, m_name, m_method, m_action)
    @id = m_id
    @name = m_name
    @method = m_method
    @action = m_action
    @hiddenFields = Array.new()
  end

  def id=(n_id)
    @id = n_id
  end

  def name=(n_name)
    @name = n_name
  end
  
  def method=(n_method)
    @method = n_method
  end
  
  def action=(n_action)
    @action = n_action
  end
...

Apache 2, ruby 1.8.2, Gentoo Linux.

Many thanks in advance!

Étienne Brouillard

How odd. Perhaps a path thing? Are there multiple (different)
copies of RDForm on you system? Or maybe permissions. What happens if
you require a file that apache can't access? Does it complain?

    -- Markus

···

On Sat, 2004-10-23 at 15:46, Étienne Brouillard wrote:

Hi!

I'm begining with eRuby and I have a difficulty with a chunk of my code. I
have my index.rhtml wich contains a require, a .rb that is located in
Ressources/Ruby/RDForm.rb. When I run index.rhtml through eRuby, it goes
through perfectly fine but when I try to access it through Apache, I get
this error:

<-- Error -->
[Sat Oct 23 18:31:18 2004] [error] mod_ruby:
/home/http/godsiocorp/index.rhtml:8: uninitialized constant
#<Module:0x4120f22c>::RDForm (NameError)
[Sat Oct 23 18:31:18 2004] [error] mod_ruby: from (eval):117
[Sat Oct 23 18:31:18 2004] [error] mod_ruby: from
/usr/lib/ruby/1.8/apache/eruby-run.rb:116:in `eval_string_wrap'
[Sat Oct 23 18:31:18 2004] [error] mod_ruby: from
/usr/lib/ruby/1.8/apache/eruby-run.rb:116:in `run'
[Sat Oct 23 18:31:18 2004] [error] mod_ruby: from
/usr/lib/ruby/1.8/apache/eruby-run.rb:72:in `handler'

Here is the chunk in index.rhtml that causes some problems :

<-- index.rhtml -->
<%
       #Requires
       require 'Ressources/Ruby/RDForm'

       #begin
               form = RDForm.new("mainForm", "main", "POST", "index.rhtml")

%>

And RDForm.rb looks like that (in part)

<-- RDForm.rb -->
require 'Ressources/Ruby/RDIncludes.rb'

class RDForm
  
  def initialize(m_id, m_name, m_method, m_action)
    @id = m_id
    @name = m_name
    @method = m_method
    @action = m_action
    @hiddenFields = Array.new()
  end

  def id=(n_id)
    @id = n_id
  end

  def name=(n_name)
    @name = n_name
  end
  
  def method=(n_method)
    @method = n_method
  end
  
  def action=(n_action)
    @action = n_action
  end
...

Apache 2, ruby 1.8.2, Gentoo Linux.

Many thanks in advance!

Étienne Brouillard