Remco Zwaan wrote:> Hi..
>
> There are my nested routes
>
> map.resources :continent do |continent|
> continent.resources :land do |land|
> land.resources :destination
> end
> end
>
> By example it generates this url
>
> http://example/continent/azie/land/japan/destination/aomori
>
> I want
>
> http://example/continent/azie/japan/aomori
>
> How can i realize this...?
>
> Grtz...remco
Thats the way nested resources work.
/:controller_one/:id_one/:controller_two/:id_two/...etc...
This is because a resource may have more than 1 type of child resource
and there needs to be a way to figure out which you are talking about.
You want a custom route, like:
map.destination "continent/:contintent_id/:land_id/:id
Now you can do:
destination_path(:continent_id => ''azie'', :land_id =>
''japan'', :id =>
''aomori'')
to get:
/continent/azie/japan/aomori
RESTful routes don''t always give you everything you need.
--
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
-~----------~----~----~----~------~----~------~--~---