[Maypole] Re: Maypole responding to requests very slowly (or, how to get just one associated record instead of getting the world)

Simon Flack sf@flacks.net
Sat, 4 Dec 2004 16:36:37 +0000


On Fri, 3 Dec 2004 11:32:54 -0800 (PST), Peter Speltz wrote
> --- Simon Flack <sf@flacks.net> wrote:
> 
> > 
> > It just seems a little odd to me to alter the relationship between the 
> > model and the view by setting a template variable.
> 
> Well, when a gets relationship is dysfunctional sometimes you simply 
> have to spice it up a little. :) IMO, its changing it any but only 
> making it better. Relationship is still -- View::Base is a good 
> friend to Model and sets some default template_args for it.  Models 
> can override them.
> 
> >It feels more like a 
> > hack than a proper solution. I don't mean any offence, we may have to go 
> > with hacks for the short-term to preserve compatability. but I'd like to 
> > know what the ideal solution would be first.
> 
> No offense. Its a hack.  If i could code the ideal solution on my 
> own I would have submitted a patch already  and not wasted my or 
> others's time talking about it :) Is there any chance of knowing the 
> ideal solution soon , so we can go ahead and start using it ?

I think I'm sold on your idea of setting template_args. It's simple and fairly
intuitive and it requires the least amount of work. For more advanced
requirements you can still use a custom model/view.

So, unless anyone objects, in 2.05 you'll be able to set
$r->template_args->{classmetadata}{foo} and the view class won't attempt to
set its own classmetadata.foo.

It'll also makes it easier to extend classmetadata with properties of your own.

--simonflk