[Nitro] @template_root not set for secondary controllers
Peter Abrahamsen
rainhead at gmail.com
Tue Sep 6 02:35:16 EDT 2005
George,
The answer to this is that compiler.rb doesn't instantiate the
controller class before calling template_root. Class attributes are
private, so you have to write a class method. The following code made
my controller work:
def PlayerController.template_root
'template/player'
end
In tracking this down, it looks like Nitro guesses the location of
the template based on the path name. I thought I'd be able to put my
code in template/players, but for some reason this didn't work. I
haven't looked into it any more now that I have something that works.
As you say, this system could use some improvement. You know what'd
be appropriate better than I, but an automatic template_root()
inserted by compiler.rb and usable like action, pre, post, etc, is
obvious. But perhaps it would be most correct to have it typically
set from run.rb?
Cheers, P
On Sep 5, 2005, at 12:42 AM, George Moschovitis wrote:
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20050906/3ca4c4b5/attachment.html
More information about the Nitro-general
mailing list