Raj
2009-Jan-05 02:17 UTC
How to declare a member for a restful resource when it has a nested resource
Currently my routes.rb looks like this. map.resources :cities do |cities| cities.resources :venues, :collection => {:transfer => :any} end Now I have a need to declare something like map.resources :cities, :collection => {:manage => :get} But since I have a nested resource for cities I am not sure what the syntax is to declare a collection on cities? Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Andrew Bloom
2009-Jan-05 03:07 UTC
Re: How to declare a member for a restful resource when it has a nested resource
The collection and other options are just a hash being passed as parameters to the resources method. The ruby language defines all parameters before blocks in method calls. Try the following: map.resources :cities, :collection => {:manage => :get} do |cities| cities.resources :venues, :collection => {:transfer => :any} end On Jan 4, 8:17 pm, Raj <neeraj....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Currently my routes.rb looks like this. > > map.resources :cities do |cities| > cities.resources :venues, :collection => {:transfer => :any} > end > > Now I have a need to declare something like > > map.resources :cities, :collection => {:manage => :get} > > But since I have a nested resource for cities I am not sure what the > syntax is to declare a collection on cities? > > Thanks in advance.--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---