Forum: Ruby on Rails Routing multiple sub-categories

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Stephen B. (Guest)
on 2006-05-24 17:12
(Received via mailing list)
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
This topic is locked and can not be replied to.