Hallo Herman,

wenn du im Projektverzeichnis "rake routes" aufrufst, werden die die Routen angezeigt.

Dort sieht du dann auch:

project_iteration_task
  GET /projects/:project_id/iterations/:iteration_id/tasks/:id
    {:controller=>"tasks", :action=>"show"}

Die Methode erwartet drei Parameter: project_id, iteration_id und id für Task.
Der Aufruf lauter daher:

project_iteration_task(task.iteration.project, task.iteration, task)

oder

project_iteration_task(:project_id => task.iteration.project, :iteration_id => task.iteration, :id => task)


Grüße
Thomas


Am 01.11.2008 um 16:23 schrieb Herman Müller:

Hallo,

ich habe ein Problem mit nested resources.

Ich habe in der routes.rb folgenden Eintrag:

 map.resources :projects do |project|
   project.resources :iterations do |iteration|
     iteration.resources :tasks
   end
 end

wenn ich folgenden Link ausgeben will über:

<%= link_to 'Show', project_iteration_task_path(task.iteration.project,
task) %>

bekomme ich folgenden Link angezeigt:

http://localhost:3000/projects/2/iterations/117/tasks/32

Das Problem ist jedoch, dass die die IDs von iterations und task
vertauscht werden. Also eigentlich ist die iteration_id = 32  und die
task_id = 117.

Kennt jemand eine Lösung für mein Problem bzw. was mache ich falsch?

Vielen Dank im voraus!
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

---
Thomas Baustert
b-simple.de - Ruby on Rails - Entwicklung & Training
Bei den Mühren 70, 20457 Hamburg
+49 (173) 2391143 - thomas.baustert(at)b-simple.de
Umsatzsteuer-Identifikationsnummer: DE814405137













_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

Antwort per Email an