Routing multiple sub-categories


#1

Hi all,

Does anyone have a neat way to route n-number of sub-categories:

/categories/category/sub-category/sub-sub-category/

I have the application successfully using a single level of categories,
but it needs to use sub-categories now with the above format.

It’d only really need to grab the last path entry and pass that onto the
categories controller. These paths would only have ‘categories’ followed
by the category and subcategories with a page number on the end for
pagination.

The route would be like this:

map.connect ‘/categories/(ignore or grab this bit)/:category/:page’,
:controller => ‘categories’,
:page => /\d+/

Any advice on this would be great.

Cheers!
Steve