I've come from a PHP/C# background so I'm not familiar with how Ruby works in a web environment. I was trying to get it to output stuff via 'print' but didn't realise you had to send the content type header first.
The book I was reading (http://www.rubycentral.com/pickaxe/web.html) unhelpfully gave an example that did this but also sent the HTTP response code before that, which stopped it from working again, so I didn't realise what the problem was.
Is there anywhere I can find a decent guide to web programming in Ruby that doesn't involve Rails? None of the ones I've seen have actually explained details like this (e.g. that you need to send the header first) – things that would be completely non-obvious to a beginner.
Another couple of questions:
1. How would I get it to display the error messages rather than sending a 500 and just dumping them in the log?
2. Is there any way of 'including' an eRuby file from a normal CGI Ruby script in the way that PHP inclusion works? (i.e. the script is evaluated and all output is sent to the output buffer.)
Anyway, thanks a lot for clearing that up for me!