# Get name of nesting controller in route

**URL:** <https://www.ruby-forum.com/t/get-name-of-nesting-controller-in-route/87083>\
**Category:** Rails\
**Created:** [February 28, 2007, 12:51am UTC](https://www.ruby-forum.com/t/get-name-of-nesting-controller-in-route/87083 "2007-02-28T00:51:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![werdnativ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ecd19e/32.png) [@werdnativ](https://www.ruby-forum.com/u/werdnativ)\
**Post date:** [February 28, 2007, 12:51am UTC](https://www.ruby-forum.com/t/get-name-of-nesting-controller-in-route/87083/1 "2007-02-28T00:51:54Z")

</div>

If I have nested resources:

map.resources ‘projects’ do |project|  
project.resources ‘members’  
end

When I send a request to /projects/1/members/, I can find my  
controller name in my helper by calling:

controller.controller\_name  
=\> “members”

Is there a clean way to find the controller name for the part of the  
request\_uri that refers to ‘projects’ or deeper nesting? I’m working  
around this by parsing the uri string, but I’d like to know how I’d  
handle this when the controller name doesn’t match the name of the  
route.

–Andrew
