Forum: Ruby on Rails nested rest

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
88e98c5398a3b4af4d0eaefacf69f8b7?d=identicon&s=25 unknown (Guest)
on 2007-02-17 20:47
(Received via mailing list)
If I might have a newbie question:

I'm trying to make a restful app with nested URL-s, like:


My problem is, that now the named paths are not working in my rhtml

<% for work_time in @work_times %>
 <td><%=link_to 'Show', work_time_path(work_time) %></td>

--> generates an error:

work_time_url failed to generate from
{:worker_id=>"1", :controller=>"work_times", :action=>"show"},
expected: {:controller=>"work_times", :action=>"show"}, diff:

I understand, that the :id => should be the first thing
in the hash, and thats what should happen with
"work_time_path(work_time)". But the :worker_id gets there. Could
someone help me out why this is happening?

Thx a lot!
15c80c9bf8be5ba6e5eeac9cb0304464?d=identicon&s=25 Ed Hickey (Guest)
on 2007-02-18 03:55
(Received via mailing list)
for nested routes you need a link to the parent in the helpers:

<%= work_time_path(@worker, work_time) %>

This topic is locked and can not be replied to.