Changing template path based on a request

I want to serve template files from a different location based on the
incoming request.

So, if the user requests www.example.com, a filter on application.rb is
able to determine that it needs to look in
RAILS_ROOT/sites/example.com/views/ for templates - but if www.test.com
is the requested host then to serve from
RAILS_ROOT/sites/test.com/views

I am assuming that to do this I will need to patch render_template to
change the location it is going look for templates in. Has anyone done
this already or suggest a better approach to this problem I'd be very
grateful...

David