Is it possible to nest a resource more than a single level? For example something like this:
map.resources :articles do |article| article.resources :comments do |comment| comment.resources :foo end end
Is it possible to nest a resource more than a single level? For example something like this:
map.resources :articles do |article| article.resources :comments do |comment| comment.resources :foo end end
Don’t see why not. Have you tried it and had problems?
Jason
The scenario explained in that article is pretty specific. There are many instances where nesting further than a single level deep is necessary. For example, if you were creating CRM system, you may have a structure like:
map.resources :customers do |customers| customers.resources :ships do |ships| ships.resources :accounts end end
Here, each customer can have many shipping addresses and for each shipping address there can be many ship accounts (ups, fedex, etc). In addition, a shipping account is only associated with a single shipping address and therefore should only be referenced through the shipping address.