nested resource routing

Richard Manyanza
Fri, 29 Feb 2008 11:06:32 -0000

I am using rails 1.2.6 and I''m trying to define a RESTified route that
will work for a nested resource. I have a permission resource that I
want to be nested into all my other resources. If I wanted to nest
permission specifically for say my customer resource then that would
simply be:

map.resources :customers do |customer|
 customer.resources :permissions
end

and this will give me url methods such as permissions_url(@customer),
permission_url(@customer, :permission_id) etc.

However what I want to achieve is a generic route definition that will
give me this functionality across all my resources. Something possibly
looking like:

map.resources :any do |any|
 any.resources :permissions
end

where any can be any resource and have url methods like
permissions_url(@books),
permission_url(@itineraries, :permission_id).

Any ideas will be appreaciated. Thanks.
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---