You can do that with map.connect ‘:category_name/:product_name’,
:controller
=> <controller_name>, :action => <action_name>
You’ll have to think about how good an idea it is to use only category
and
product names and not ids
Think about using to_param on your models which can then display both id
and
name
class Category < ActiveRecord::Base
def to_param
“#{id}-#{name.gsub(/[^\w\d]+/, ‘-’)}”
end
end
Then you don’t have to mess with your routes and your urls will be
/1-category/2-product and your controllers will still get the id in
params[:id]