D. Taylor,
I believe your edit url should be:
vendor_edit_category_path(@vendor, @category)
You need to pass in the parent id as well.
Shane Vitarana
http://shanesbrain.net
On 10/1/06, D. Taylor Singletary
<taylorsingletary-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi there, I''m having a problem with the named url helpers the
resource
> mapper in routes.rb produces.
>
> I have a model where a Vendor has_many Categories.
>
> So I setup routing like so:
> map.resources :vendors do |vendor|
> vendor.resources :categories, :name_prefix => "vendor_"
> end
>
> This should provide me with...
> vendor_category_path
> vendor_edit_category_path
> and vendor_new_category_path
>
> But when I attempt to use those very helpers, I get this error:
>
> ActionView::TemplateError (vendor_edit_category_url failed to generate from
> {:action=>"edit", :controller=>"categories",
:vendor_id=>"1"}, expected:
> {:action=>"edit", :controller=>"categories"},
diff: {:vendor_id=>"1"}) on
> line #12 of app/views/categories/index.rhtml:
> 9: <tr>
> 10: <td><%= link_to category.name,
vendor_category_path(category)
> %></td>
> 11: <td><%= link_to ''Show'',
vendor_category_path(category) %></td>
> 12: <td><%= link_to ''Edit'',
> vendor_edit_category_path(category) %></td>
> 13: <td><%= link_to ''Destroy'',
vendor_category_path(category), :confirm
> => ''Are you sure?'', :method => :delete
%></td>
> 14: </tr>
> 15: <% end %>
>
> Am I misunderstanding something or is this bit of code still a work in
> progress in Edge rails as far as nested resources are concerned? What can I
> do in the meantime to vendor_edit_category_url that it *should* be
expecting
> a vendor_id in the mix?
>
> Here''s a snippet of my view:
> and in the view:
>
> <% for category in @categories %>
> <tr>
> <td><%= link_to category.name, vendor_category_path(category)
%></td>
> <td><%= link_to ''Show'',
vendor_category_path(category) %></td>
> <td><%= link_to ''Edit'',
> vendor_edit_category_path(category) %></td>
> <td><%= link_to ''Destroy'',
vendor_category_path(category), :confirm =>
> ''Are you sure?'', :method => :delete %></td>
> </tr>
> <% end %>
>
> Any help is much appreciated! Thanks.
> --
> D. Taylor Singletary
> Reality Technician
> "Look at my hair; like the design." -- David Byrne
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---