Forum: Ruby on Rails How to declare a member for a restful resource when it has a nested resource

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
934f858e451cf9b771996b2940cd696b?d=identicon&s=25 Raj Singh (dorelal)
on 2009-01-05 03:18
(Received via mailing list)
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.
6fabb84e727dee98d1277df56458cbac?d=identicon&s=25 Andrew Bloom (Guest)
on 2009-01-05 04:08
(Received via mailing list)
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
This topic is locked and can not be replied to.