# Nested controllers problem in production env

**URL:** <https://www.ruby-forum.com/t/nested-controllers-problem-in-production-env/119936>\
**Category:** Rails\
**Created:** [November 12, 2007, 12:49pm UTC](https://www.ruby-forum.com/t/nested-controllers-problem-in-production-env/119936 "2007-11-12T12:49:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghostrifle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghostrifle](https://www.ruby-forum.com/u/ghostrifle)\
**Post date:** [November 12, 2007, 12:49pm UTC](https://www.ruby-forum.com/t/nested-controllers-problem-in-production-env/119936/1 "2007-11-12T12:49:59Z")

</div>

Hi people,

I’m using nested controllers in my dev env without any problems.

Well… I’ve got a controller which is a nested controller of  
Customerbackend:

class Customerbackend::AdvertisementController \< ApplicationController  
layout “Customerbackend”

so… my AdvertisementController used the layout of Customerbackend… so  
far no problem. The AdvertisementController works like a charm in dev  
mode.

I’m opening the controller with a link\_to method like this:

\<%= link\_to ‘Anzeigenverwaltung’, :controller =\>  
‘/customerbackend/advertisement’, :action =\> ‘listAdvertisements’%\>

On my production server I’m getting the following error when I try to  
access it :

Processing AdvertisementController#listAdvertisements (for 89.61.205.195  
at 2007-11-12 12:39:55) [GET]  
Session ID: b9ef65c1265a02809b583c0133183407  
Parameters: {“format”=\>“jpg”, “action”=\>“listAdvertisements”,  
“id”=\>“404”, “controller”=\>"/customerbackend/advertisement"}

ActionController::MissingTemplate (Missing layout  
/var/www/saarbabes2/releases/20071112112035/app/views/layouts/Customerbackend.rhtml):

The curious thing is that rails tries to call Customerbackend.rhtml  
instread customerbackend.rhtml which does exist !!

Does anyone have a solution to my problem ?? What am I doing wrong ??

Regards,  
Alex

---

<div class="post-metadata">

**Author:** ![ghostrifle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghostrifle](https://www.ruby-forum.com/u/ghostrifle)\
**Post date:** [November 12, 2007, 2:22pm UTC](https://www.ruby-forum.com/t/nested-controllers-problem-in-production-env/119936/2 "2007-11-12T14:22:30Z")

</div>

On 12 Nov 2007, at 11:49, Alexander Bierbrauer wrote:

> class Customerbackend::AdvertisementController \< ApplicationController  
> layout “Customerbackend”

[snip]

> ActionController::MissingTemplate (Missing layout  
> /var/www/saarbabes2/releases/20071112112035/app/views/layouts/  
> Customerbackend.rhtml):
> 
> The curious thing is that rails tries to call Customerbackend.rhtml  
> instread customerbackend.rhtml which does exist !!

because you told it that the layout was Customerbackend not  
customerbackend ? I’m guessing that in development you’re using a mac  
or windows so filenames are case-insenstive, but when you deploy on a  
linux box then suddenly case matters.

Fred

---

<div class="post-metadata">

**Author:** ![ghostrifle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghostrifle](https://www.ruby-forum.com/u/ghostrifle)\
**Post date:** [November 12, 2007, 2:38pm UTC](https://www.ruby-forum.com/t/nested-controllers-problem-in-production-env/119936/3 "2007-11-12T14:38:56Z")

</div>

ass Customerbackend::AdvertisementController \< ApplicationController

> because you told it that the layout was Customerbackend not  
> customerbackend ? I’m guessing that in development you’re using a mac  
> or windows so filenames are case-insenstive, but when you deploy on a  
> linux box then suddenly case matters.

Thank you man !!! I thought MAC uses case-sensitive files too… my  
mistake

Regards,  
Alex

---

<div class="post-metadata">

**Author:** ![ghostrifle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghostrifle](https://www.ruby-forum.com/u/ghostrifle)\
**Post date:** [November 12, 2007, 4:46pm UTC](https://www.ruby-forum.com/t/nested-controllers-problem-in-production-env/119936/4 "2007-11-12T16:46:54Z")

</div>

Hi again,

well changing the filename from my previous post works like a charm…  
but now I’ve got another problem… 'cause my nested controller doesn’t  
get called. I’m getting a 404 error… my production.log tells me the  
following:

Processing CustomerbackendController#advertisement (for 89.61.205.195 at  
2007-11-12 16:41:05) [GET]  
Session ID: 5a04b66b8ec84b845587f7384ff62247  
Parameters: {“action”=\>“advertisement”, “id”=\>“listAdvertisements”,  
“controller”=\>“customerbackend”}

ActionController::UnknownAction (No action responded to advertisement):

I’m using the following link\_to to access my controller:

\<%= link\_to ‘Anzeigenverwaltung’, :controller =\>  
‘/customerbackend/advertisement’, :action =\> ‘listAdvertisements’%\>

damn… why does it work in my development environment but not in the  
production env ??

Regards,  
Alex

---

<div class="post-metadata">

**Author:** ![ghostrifle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghostrifle](https://www.ruby-forum.com/u/ghostrifle)\
**Post date:** [November 12, 2007, 7:56pm UTC](https://www.ruby-forum.com/t/nested-controllers-problem-in-production-env/119936/5 "2007-11-12T19:56:09Z")

</div>

> Are the .rb files containing the controllers or the various folders  
> all named with the correct case?
> 
> >

Hi,

my folder layout looks like this:

-controllers  
–admin\_controller.rb  
–customerbackend\_controller.rb  
–admin  
—advertisement\_controller.rb  
–customerbackend  
—avertisement\_controller.rb

And here’ the names of my controllers:

CustomerbackendController \< ApplicationController  
Customerbackend::AdvertisementController \< ApplicationController  
AdminController \< ApplicationController  
Admin::AdvertisementController \< ApplicationController

So… do you see my error ??

Regards,  
Alex

---

<div class="post-metadata">

**Author:** ![ghostrifle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghostrifle](https://www.ruby-forum.com/u/ghostrifle)\
**Post date:** [November 12, 2007, 5:00pm UTC](https://www.ruby-forum.com/t/nested-controllers-problem-in-production-env/119936/6 "2007-11-12T17:00:24Z")

</div>

On 12 Nov 2007, at 15:46, Alexander Bierbrauer wrote:

> 89.61.205.195 at  
> 2007-11-12 16:41:05) [GET]  
> Session ID: 5a04b66b8ec84b845587f7384ff62247  
> Parameters: {“action”=\>“advertisement”, “id”=\>“listAdvertisements”,  
> “controller”=\>“customerbackend”}

Are the .rb files containing the controllers or the various folders  
all named with the correct case?

---

<div class="post-metadata">

**Author:** ![ghostrifle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghostrifle](https://www.ruby-forum.com/u/ghostrifle)\
**Post date:** [November 12, 2007, 10:30pm UTC](https://www.ruby-forum.com/t/nested-controllers-problem-in-production-env/119936/7 "2007-11-12T22:30:58Z")

</div>

On 12 Nov 2007, at 18:54, Alexander Bierbrauer wrote:

> -controllers  
> –admin\_controller.rb  
> –customerbackend\_controller.rb  
> –admin  
> —advertisement\_controller.rb  
> –customerbackend  
> —avertisement\_controller.rb

I’m not sure why this works in development: how is it suppose to  
disambiguate  
customerbackend/advertisement (calling the advertisement action of the  
customerbackend controller)  
customerbackend/advertisement (calling the index action of  
CustomerBackend::Advertisement

you should pick your names so that they don’t clash like this.

Fred

---

<div class="post-metadata">

**Author:** ![ghostrifle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f04885/32.png) [@ghostrifle](https://www.ruby-forum.com/u/ghostrifle)\
**Post date:** [November 12, 2007, 11:04pm UTC](https://www.ruby-forum.com/t/nested-controllers-problem-in-production-env/119936/8 "2007-11-12T23:04:56Z")

</div>

Hi,

I found the solution… just adding the following route:

map.connect ‘:controller/:action/’
