Trouble getting eRuby and RubyGems to co-operate

I’ve compiled my own copies of Ruby, RubyGems and eRuby to ~/Ruby/ (wherein were created ‘bin’, ‘man’, etc) following the rather helpful instructions on the wiki and then copied the eRuby executable to ~/etc/cgi-bin/, whereafter symbolic links make the contents of the ‘cgi-bin’ folder available to all the domain roots I have set up. I then defined an Apache handler for eRuby.

After all this, the RubyGems manager (ie. ‘gem’) seems to work fine, and eRuby performs simple operations like echoing text and performing mathematical calculations. However, if my test script results in an error (eg. a parse error), Apache spits out a 500 status. Similarly, if I try and include an installed Gem (eg. sqlite3), I get a 500 status as well, which suggests to me that this is also producing an error. I can’t imagine this is normal; what could be the problem?

I have a similar set-up with PHP5, and it works flawlessly.