Edge Rails Resource Routing Problems

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:


10: <%= link_to category.name, vendor_category_path(category)
%>
11: <%= link_to ‘Show’, vendor_category_path(category) %>
12: <%= link_to ‘Edit’, vendor_edit_category_path(category)
%>
13: <%= link_to ‘Destroy’, vendor_category_path(category),
:confirm
=> ‘Are you sure?’, :method => :delete %>
14:
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 %>

<%= link_to category.name, vendor_category_path(category) %> <%= link_to 'Show', vendor_category_path(category) %> <%= link_to 'Edit', vendor_edit_category_path(category) %> <%= link_to 'Destroy', vendor_category_path(category), :confirm => 'Are you sure?', :method => :delete %> <% end %>

Any help is much appreciated! Thanks.

D. Taylor S.
Reality Technician
“Look at my hair; like the design.” – David Byrne

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 V.
http://shanesbrain.net