Topic: connecting subcategories to categories?

How would this type of URI convention be done with rails:

site.com/catalog/category/subcategory/view/item_id
site.com/catalog/category/view/item_id  (if it does not belong to a subcategory)

The only part that I do not know how to do is the subcategory model.  Is there something I can define in categories_controller.rb to go to subcategories_controller.rb for category/subcategory?

I have tried something similar to: (in categories_controller.rb)
def subcategory
      redirect_to :controller => subcategory
end

but that did not work - and I dont know anything about redirecting to, or rendering another controller.  Any input will be helpful!

Re: connecting subcategories to categories?

You could add a line or two to your routes.rb file (in the config folder)

Maybe something like:

map.connect 'catalog/category/:action/:id', :controller => 'category'
map.connect 'catalog/subcategory/:action/:id', :controller => 'subcategory'

It's kind of redundant to have something like 'category/subcategory' in your URL, especially when you can easily eliminate it.