I created a new website, hosted with Heroku, about 3 weeks ago and have since decided I wanted to change its domain name. I was trying to figure out how to do a site wide redirect and I'm thinking of going with something like in my application controller (add a before filter):
def new_domain
redirect_to url_for(:controller => params[:controller], :action => params[:action], :id => params[:id], :host => 'http://newdomain.com'), :status => 301
end
This obviously will not work with all actions and will fail if the url is passing additional parameters. I was wondering if there is something more general I can do so I don't have to have a bunch of if else clauses?