We currently have a poor-man’s CMS (content management system) where we
use method_missing() to redirect_to a stored page in a database. I
would like to re-write the url back to the original request. How?
Example,
-
User goes to http://www.example.com/home/news
-
However, :controller => ‘home’, :action => ‘index’ doesn’t exist so
we get a method_missing which we trap in app/controller/application.rb. -
We then
ContentPage.find_by_controller_and_action(params[:controller],
params[:action]) and -
redirect_to :controller => ‘content_pages’, :action => ‘show’, :id
=> content_page.id
This works.
However, I would like to rewrite the url from:
http://www.example.com/content_pages/show/43
to the original request
http://www.example.com/home/news
Any advice or ideas?
ebeard.