[Nitro] @template_root not set for secondary controllers

Peter Abrahamsen rainhead at gmail.com
Mon Sep 5 01:08:19 EDT 2005


Nitro 0.23, everything up to date.

I'm defining a controller-specific template_root, which compiler.rb  
appears to support. Here's some of the code:

class PlayerController < Nitro::Controller
   include Nitro::XhtmlMixin

   # TODO caching, some day
   @@template_root = 'template/player'

I put a debug line in nitro/compiler.rb, at line 106:

       if cklass.respond_to?(:template_root)
         template_root = cklass.template_root
         Logger.debug "got template_root #{template_root} from # 

the debug log is as follows:

DEBUG: SELECT * FROM ogplayer WHERE oid=1
DEBUG: Rendering '/players/root'.
DEBUG: Compiling action 'PlayerController#root'
DEBUG: got template_root template from PlayerController
DEBUG: got template_root  from Nitro::Controller

This is weird. I tried setting @template_root in initialize instead  
of @@template_root in the class, but the exact same thing happens.

If I set PlayerController to be the default controller, drop the  
@template_root setting (and keep Template.root, which was there  
before), and move things to 'template' instead of 'template/player',  
everything's fine.

Any ideas?

Thanks, P

More information about the Nitro-general mailing list