I would like to filter all incoming pages via my local rails server,
so I would like to access the web by typing a url into my browser
along the lines of:
I have a controller called redirect already, in it is a function
called
index just waiting to process the incoming url, which it hopes to
find in params[:id]
Now, could some kind soul, please tell me what line to add to
my config/routes.rb so that this works?
I have a controller called redirect already, in it is a function
called
index just waiting to process the incoming url, which it hopes to
find in params[:id]
Now, could some kind soul, please tell me what line to add to
my config/routes.rb so that this works?
Well, let's think about this. The path is '/redirect' followed by the
URL to redirect to. That means that we can express it as
'/redirect/:url'.
The controller is redirect, and the action is index.
And let's give the route the name of redirect.
Put that all together and you get
map.redirect '/redirect/:url', :controller => 'redirect', :action =>
'index'