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, a filter on application.rb is
able to determine that it needs to look in
RAILS_ROOT/sites/ for templates - but if
is the requested host then to serve from

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