Forum: Ruby on Rails Question about controller inheritance

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Brij N. (Guest)
on 2007-03-29 16:09

I'm trying to apply a theme from theme_support in my entire application.
Therefore it put a theme and layout line in the ApplicationController.
The way I understand it, every subclass from this controller will also
have the provided theme.

The beginning of the applicationcontroller looks like:

   class ApplicationController < ActionController::Base
     theme Siteconfig.instance.theme
     layout 'default'

     def index

Now, when I have a new controller containing

   class PageController < ApplicationController
     def index

I get the error:

Template is missing
Missing layout ./script/../config/../app/views/layouts/page.rhtml

When I do add the theme and layout to the pagecontroller as in:
   class PageController < ApplicationController
     theme Siteconfig.instance.theme
     layout 'default'

     def index
everything works correctly.

Why does the pagecontroller doesn't inherit the theme and layout?
This topic is locked and can not be replied to.