Exception backtraces for view plugins

I’m using a plugin that adds a new templating system to my app. The
backtrace for errors in the standard rhtml templates includes the
template’s file name and the line number where the error occurred.
Errors in templates using the new templating system don’t produce

.rhtml template errors look like this:

and my plugin template errors look like this:
(erb):48:in `render’

I’ve found that the stated line number is correct - once you’ve worked
out exactly which template you need to look at. It’s OK if the action
only uses one template, but if you’re using partials things start to
get a bit tricky.

It’d be useful to be able to get the file name of the template causing
the problem into the backtrace. Does anyone know how it works in the
rails code and/or how to make it work in a plugin? I’ve had a look at
the rails code, but got lost along the way…