There is a world of difference between /users/17/groups/2/tags and /groups/2/users/17/tags. The former represents the tags associated with group 2 while the latter represents the tags associated with user 17. Unfortunately, the parameters hash provided to the (single) TagsController is identical in both cases and thus provides no hint at the nesting order of the resources. What's a RESTful acolyte to do? With the recent emphasis on nested resources, this is a looming functionality gap.
I could split into a dedicated controller per nesting hierarchy, but that is crude and un-DRY.
Several more elegant solutions come to mind, all of which require modifying the route recognition code of Rails. Perhaps the one least likely to impact existing Rails code is to add a new parameter in the params hash. For the first example above, imagine:
{:group_id => 2, :user_id => 17, :controller => :tags, :_nesting => [:user, :group]}
Now the hierarchy is clear. An even more elegant solution, but one that would break billions of existing Rails apps (config parameter anyone?) would be to nest the params to mirror the URI, like this:
{:user_id => 17, :params => {:group_id => 2, :params => {:controller => :tags}}}
Frankly, any built-in support would be wonderful because mortals don't relish monkey-patching the route recognition code.