If I might have a newbie question:
I''m trying to make a restful app with nested URL-s, like:
domain/worker/1
domain/worker/1/work_times
domain/worker/1/work_times/1
My problem is, that now the named paths are not working in my rhtml
files:
<% 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:
{:worker_id=>"1"}
I understand, that the :id => work_time.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!
PSz
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
If I might have a newbie question:
I''m trying to make a restful app with nested URL-s, like:
domain/worker/1
domain/worker/1/work_times
domain/worker/1/work_times/1
My problem is, that now the named paths are not working in my rhtml
files:
<% 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:
{:worker_id=>"1"}
I understand, that the :id => work_time.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!
PSz
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
for nested routes you need a link to the parent in the helpers: <%= work_time_path(@worker, work_time) %> ed On 2/17/07, parragh-6cA95zXwLJc@public.gmane.org <parragh-6cA95zXwLJc@public.gmane.org> wrote:> > > If I might have a newbie question: > > I''m trying to make a restful app with nested URL-s, like: > > domain/worker/1 > domain/worker/1/work_times > domain/worker/1/work_times/1 > > My problem is, that now the named paths are not working in my rhtml > files: > > <% 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: > {:worker_id=>"1"} > > I understand, that the :id => work_time.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! > PSz > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---