I am creating a new site to replace an existing one and want to preserve urls that people have bookmarked and appear in search engines. My solution to this is create a route that takes a historical url and pass that along to the controller of my choice with a new id that was looked up in a table. This seems to work in theory but I am stuck on something.
Here is my approach:
I want to take the url: /category/123 lookup 123 in a table which will return a new id for my new catalog. and send the user to a different controller with id 456 (or whatever the looked up value is)
I have a method that is called in the route and will return a value. The problem is passing the supplied id (named :cid in my code below). I can't seem to pass the value that is in the url. Everything else works. I can hard code the parameter to the catmap method and the route works.
Routes.rb
def catmap(cat)
list ={'60'=>'2','61'=>'3'}
return list(cat) end
class ApplicationController < ActionController::Base ... map.connect 'category/:cid',:controller => 'list', :action => 'model', :id =>catmap(cid) ... end