PRB: Can't add methods to base classes

S

scharfie

At a Windows command prompt, the following Ruby script executes just
fine:

class Array
def new_method()
"Hello"
end
end
puts [""].new_method

However, browsing to this script on my localhost (apache2) gives a
NoMethodError:

undefined method `new_method' for [""]:Array

I've tried with both mod_ruby and fastcgi bindings, but I can't get it
to work. Is there a config. setting I'm missing?
 

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,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top