nested controllers problem in production env

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

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

ass 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.

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

Regards,
  Alex

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

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"}

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

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

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

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

Hi,

I found the solution... just adding the following route:

map.connect ':controller/:action/'