I've developed a new Ruby on Rails site for my organization. I want the new Rails site to intercept incoming requests that were meant for the old site and display a message for the user indicating that the new site is launched, a link the new URL they were most likely trying to get to, and a reminder to update bookmarks.
So I'm pretty green when in comes to rails routing so I'm asking how would you do this. Is there a 'rails way'?
Here are my thoughts so far.
The old site does not use clean urls so every request goes to the default route which in the new site is the home
controller with a query string. I was thinking in the controller I can test to see if params[:q]
is set and then depending on what the q parameter is, search for and render the an info page directing the user to the new link. If the q parameter doesn't make sense (I don't care about catching every page on the old site, just the important ones) redirect to a custom 404 page informing the user that the link was probably for the old site, and give the user a search page.
Any thoughts, is there a better way?
I appreciate any input.
Thanks