# Need help with nested resource and link\_to

**URL:** <https://www.ruby-forum.com/t/need-help-with-nested-resource-and-link-to/125900>\
**Category:** Rails\
**Created:** [January 13, 2008, 3:36pm UTC](https://www.ruby-forum.com/t/need-help-with-nested-resource-and-link-to/125900 "2008-01-13T15:36:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hardbap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/c89c15/32.png) [@Hardbap](https://www.ruby-forum.com/u/Hardbap)\
**Post date:** [January 13, 2008, 3:36pm UTC](https://www.ruby-forum.com/t/need-help-with-nested-resource-and-link-to/125900/1 "2008-01-13T15:36:02Z")

</div>

I’ve read all the posts, blogs, peepcode about nested resources but I  
can’t get link\_to to work. I know I’m missing something simple so I  
hope another set of eyes will help out.

I have a pretty simple set up:

deliverable has\_many :roles

role belongs\_to :deliverable

here is what I have in routes.rb:  
map.resources :deliverables, :has\_many =\> :roles

from views/deliverables/show.html.erb I’m trying to provide a link to  
add a new role with this:

\<%= link\_to “+ Add Role”, new\_role\_url(@deliverable) %\>

But I get this error when rendering: undefined method `new\_role\_url’

I can type in the url [http://localhost:3000/deliverables/1/roles/new](http://localhost:3000/deliverables/1/roles/new)  
and it works fine so I’m stumped.

Thanks in advance for the help.

rails 2.0.2  
ruby 1.8.6

---

<div class="post-metadata">

**Author:** ![Hardbap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/c89c15/32.png) [@Hardbap](https://www.ruby-forum.com/u/Hardbap)\
**Post date:** [January 13, 2008, 3:44pm UTC](https://www.ruby-forum.com/t/need-help-with-nested-resource-and-link-to/125900/2 "2008-01-13T15:44:17Z")

</div>

figured it out by checking out rake routes. should be:

\<%= link\_to “+ Add Role”, new\_deliverable\_role\_path(@deliverable) %\>
