Meh; no biggy.

Now, I've got a slightly more architectural question: supported locals
are essentially precompile, no? What happens if the first render of
template doesn't contain all the locals the template supports? That
is, partial A is defined as such:
= "Got parameter x: #{x.inspect}" if defined?(x)
= "Got parameter y: #{y.inspect}" if defined?(y)
= "-"

Then, there's a view like so:
= render :partial => 'A', :locals => { :x => "Cat" }
= render :partial => 'A', :locals => { :y => "Apple" }

If I understand the do_precompile code properly (lines 214-219):
214      supported_local_assigns = {}
215     @@[EMAIL PROTECTED] = supported_local_assigns
216     @options[:locals].each do |k,v|
217              supported_local_assigns[k] = true
218              push_silent "#{k} = _haml_local_assigns[:#{k}]"
219     end

A gets x allocated for it, but not y; here's the output I'd expect (I
haven't actually tested this; it is a Gedanken):

Got parameter x: "Cat"
-
Got parameter x: nil
-

Am I thoroughly confused?

Nick

On May 16, 10:25 pm, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
> Whoops! I should have caught that. I'll fix it as soon as I'm able (I
> just got a new computer, and I have yet to install Ruby or Subversion on
> it - soon, though!).
>
> - Nathan
>
> Nick Howell wrote:
> > Thought I'd seen the last of this one[1].
>
> > engine.rb:
> > 421         @scope_object.class.instance_eval do
> > 422            include CompiledTemplates
> > 423        end
>
> > Should be
> > @scope_object.extend(CompiledTemplates)
>
> > [1]:http://groups.google.com/group/haml/browse_frm/thread/c6a681ae92ae1b1...
>
> > What're the chances?
>
> > I'd be careful of ever doing .class.instance_eval.
>
> > Nick


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to