Newbie here, so probably something stupid :)
I'm trying to play with the erb templating in Ruby. It works fine at home - Apache on windows. But when I upload it to the server it breaks every time... Simple example:
require "erb"
class Stuff
def initialize( name )
@name = name
end
def get_binding
binding
end
end
template = %{
<html>
<head><title><%= @name %></title></head>
<body>Nothing to see here</body>
</html>
}
rhtml = ERB.new(template)
foo = Stuff.new("Hello")
puts "Content-type: text/html\n\n"
rhtml.run(foo.get_binding)
This does what I expect on my home server, but on the remote server I get a compile error. It always seems to appear when I try to evaluate any Ruby expression. From the server logs of generated code:
template = %{
\t<html>
\t\t<head><title><%= @name ; print "</title></head>\\n"
print "\\t\\t<body>Nothing to see here</body>\\n"
The remote sever shows as Linux cl39 2.6.33.1mtv2 #1 SMP Tue Jul 20 21:31:39 PDT 2010 i686 GNU/Linux ruby ruby 1.8.5 and eruby
Been banging my head into the wall for a while on this. I think it's time to ask the experts...