Say I have my urls like:
www.example.com/categories/category1/subcategory1
My database would have a table Categories:
ID NAME parentID 1 category1 -1 2 subcategory1 1
So I would need to load both category ID 1 and 2 since that is what is being displayed.
I know my explanation isn't that clear, but I hope what I am after is!
OH, and how would this route be开发者_运维百科 setup, since there could be an unlimited # of category/subcategory/sub-subcateogry levels.
http://guides.rubyonrails.org/routing.html#nested-resources
Following convention over configuration:
Resources should never be nested more than 1 level deep.
The rest of those guides are a good read.
精彩评论