[Nitro] @template_root not set for secondary controllers

George Moschovitis george.moschovitis at gmail.com
Mon Sep 5 03:42:53 EDT 2005


You have to use 
@template_root instead of @@template_root.

This should work, dunno why it doesnt work for you (perhaps an
accessor method for @template_root is not defined?)

In any case, the template_root setting needs some improvement,
@template_root = ... is not as elegant as it should be.

regards,
George.

On 9/5/05, Peter Abrahamsen <rainhead at gmail.com> wrote:
> Hi,
> 
> 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'
>    ...
> end
> 
> 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 #
> {cklass.to_s}"
>        end
> 
> 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
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
> 


-- 
http://www.gmosx.com
http://www.navel.gr
http://www.nitrohq.com




More information about the Nitro-general mailing list