[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

mod_ruby+eruby module inclusion confusion

Mark J. Reed

2/18/2005 7:40:00 PM

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?