mod_ruby+eruby module inclusion confusion

M

Mark J. Reed

I upgraded to ruby 1.8.2, eruby 1.0.5, and mod_ruby 1.2.4 without otherwise
changing my existing Apache 2.0.48 installation, and a bunch of pages broke.

It turns out that the following is what's not working. Given a file
'my_module.rb' which defines module MyModule which has a method called
my_method, this used to work:

<% require 'my_module' %>
<% include MyModule %>

... bunch of HTML ...

<%= my_method; %>

And it still does when I run eruby from the command line. But when the
same rhtml file is run via mod_ruby, the include doesn't seem to work; it's
like it's getting run in a subscope or something and not affecting the
same main object used by the rest of the script. I have to change
the my_method; call to be explicitly MyModule::my_method;.

Any ideas why this would be the case?
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top