Make sure your shebang line is correct and that your Apache knows  
about Ruby.
#!/usr/local/bin/ruby

might not be it.

It maybe good to try:
#!/usr/bin/ruby

or:
#!/usr/bin/env ruby

This one checks the env to find out where ruby is located.
But both could be totally different, very easily.
Check with your Apache server admin, they will (or should) know.


John Joyce