What version of Haml are you using? There were issues like this in 
previous versions, but I was under the impression that they were gone in 
1.7...

- Nathan

drew wrote:
> I'm new to Haml, and I've been using it for some non-rails web-app
> work I've been doing. Recently I've run into some funny behaviour that
> I'm at a loss to explain and I'm hoping someone can help me out.
>
> I've defined this method to use when I want to render a template:
>   def render(file, vars = {})
>     template = File.read('templates/'+file)
>     engine = Haml::Engine.new(template, :locals => vars)
>     return engine.render
>   end
>
> I have a line in one of my templates like this:
>   %= foo
>
> Now, if I render this template and define :foo in the vars hash
> everything works out as I would expect, but then if I render the
> template again, passing an empty vars hash the value of :foo that I
> had set previously will still be rendered in the template. If I
> explicity set vars[:foo] to nil in #render it does not render, but as
> soon as I remove that line, the last value of :foo starts rendering
> again.
>
> Is this supposed to happen? If so can anyone shed some light on why?
> Is there a way to stop this from happening?
>
> A little more info if it's helpful:
> Render is getting called when I place a request to a webrick server.
> (Obviously?) when I restart the server and call #render with vars
> empty I get an error saying foo is an undefined variable.
>
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
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