# Nested controllers

**URL:** <https://www.ruby-forum.com/t/nested-controllers/122429>\
**Category:** Rails\
**Created:** [December 7, 2007, 3:32pm UTC](https://www.ruby-forum.com/t/nested-controllers/122429 "2007-12-07T15:32:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thefatpenguin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8edcca/32.png) [@thefatpenguin](https://www.ruby-forum.com/u/thefatpenguin)\
**Post date:** [December 7, 2007, 3:32pm UTC](https://www.ruby-forum.com/t/nested-controllers/122429/1 "2007-12-07T15:32:50Z")

</div>

Hello all,

Can anyone give me a bit of advice on nested controllers?

I am using rails 1.2.6.

I have controllers/views directory structures as:

controllers  
-products  
–product1\_controller.rb  
–product2\_controller.rb  
-products\_controller.rb

views  
-products  
–product1  
—index.rhtml  
—other\_info1.rhtml  
–product2  
—index.rhtml  
—other\_info2.rhtml  
–index.rhtml  
–other\_info.rhtml

The ideas is that summary information about all products is provided  
by actions in the products controller, and information specific to  
each product is provided from the nested product controllers. Url’s  
would be as:

/products  
/products/other\_info  
for general products information

/products/product1  
/products/product1/other\_info1  
for information specific to product 1

This all seems to work fine on my windows development environment, but  
on production linux environment with exact same versions of ruby and  
rails it cannot resolve the product-specific url’s with a  
“ActionController::UnknownAction (No action responded to product1):”  
error.

Removing/renaming the products\_controller.rb does allow the nested  
product-specific urls to be resolve, but of course the generic  
products information is no longer viewable under /products.

Is there a better/correct way of doing this?

Any info gratefully received…
