Routes + links

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)

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

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. [email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs