# Routes + links

**URL:** <https://www.ruby-forum.com/t/routes-links/137166>\
**Category:** Rails\
**Created:** [May 9, 2008, 4:49pm UTC](https://www.ruby-forum.com/t/routes-links/137166 "2008-05-09T16:49:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![remco123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/779978/32.png) [@remco123](https://www.ruby-forum.com/u/remco123)\
**Post date:** [May 9, 2008, 4:49pm UTC](https://www.ruby-forum.com/t/routes-links/137166/1 "2008-05-09T16:49:05Z")

</div>

Hi…

link problem…this is my setup

class Land \< ActiveRecord::Base  
belongs\_to :werelddeel, :foreign\_key =\> “werelddeel\_id”  
has\_many :bestemming  
set\_table\_name “landen”  
set\_primary\_key “landcode”

has\_permalink :land\_zoeknaam

def to\_param  
land\_zoeknaam  
end  
end

class Bestemming \< ActiveRecord::Base  
has\_many :land, :foreign\_key =\> “landcode”  
set\_table\_name “bestemmingen”  
set\_primary\_key “bestemming\_id”  
has\_permalink :stad\_zoeknaam

def to\_param  
stad\_zoeknaam  
end  
end

routes.rb

map.resources :werelddeel do |werelddeel|  
werelddeel.resources :land do |land|  
land.resources :bestemming  
end  
end

rake routes  
werelddeel\_land\_bestemming GET  
/werelddeel/:werelddeel\_id/land/:land\_id/bestemming/:id

The view of my werelddeel (continents) to show the countries (landen).  
This works fine ([http://www.goedkoop-vliegen.nu/werelddeel/europa](http://www.goedkoop-vliegen.nu/werelddeel/europa))

## Landen

\<% @landen.each do |land| %\>- \<%= link\_to land.naam, werelddeel\_land\_path(land.werelddeel, land)%\>
\<% end %\>

But what is the correct code for countries (landen)to show the  
destinations(bestemmingen)??

I tried this but with no succes…

## Destinations

\<% @bestemmingen.each do |bestemming| %\>- \<%= link\_to bestemming.naam, werelddeel\_land\_bestemming\_path(land, bestemming)%\>

\<% end %\>

What i am doing wrong…??

Grtz…remco

---

<div class="post-metadata">

**Author:** ![remco123](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/779978/32.png) [@remco123](https://www.ruby-forum.com/u/remco123)\
**Post date:** [May 9, 2008, 8:53pm UTC](https://www.ruby-forum.com/t/routes-links/137166/2 "2008-05-09T20:53:04Z")

</div>

It’s a little difficult battling through the language issue, but it  
appears that you’re only supplying two parameters to the  
werelddeel\_land\_bestemming\_path call. If that is singular (ie.,  
identifying a particular country) then you need three because  
bestemming is nested within both werelddeel and land.  
On May 9, 10:49 am, Remco Z. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
