# Nested Resources + :name\_prefix

**URL:** <https://www.ruby-forum.com/t/nested-resources-name-prefix/119430>\
**Category:** Rails\
**Created:** [November 6, 2007, 11:25pm UTC](https://www.ruby-forum.com/t/nested-resources-name-prefix/119430 "2007-11-06T23:25:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stickstone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Post date:** [November 6, 2007, 11:25pm UTC](https://www.ruby-forum.com/t/nested-resources-name-prefix/119430/1 "2007-11-06T23:25:21Z")

</div>

I have a resource that has a name\_prefix to avoid clashing with another  
named route. I am nesting multiple resources inside this resource, and  
the name\_prefix is not being inherited for the generated named routes by  
the nested resources. This is an issue for me because this is clashing  
with other named routes. Here is the example from my routes.rb file

map.resources :companies do |company|  
company.resources :jobs  
end

map.resource :company, :name\_prefix =\> “single\_” do |company|  
company.resources :jobs  
end

These named routes generate fine:  
company\_path(1): “/companies/1”  
single\_company\_path: “/company”

Here is the problem:  
company\_jobs\_path: “/company/jobs”  
Should (I believe) be:  
single\_company\_jobs\_path: “/company/jobs”  
and this should be:  
company\_jobs\_path(1): “/companies/1/jobs”

I might stare at the resources.rb file for a while. Is this proper  
behavior or should the name\_prefix be inherited by the nested resources?
