Hi all,
wanting to use haml for generic templating purpose, but I don't get
how it's working...
here's my code...
class Hamler
def render(partial)
template = File.read("#{Rails.root}/lib/templates/#
{partial}.haml")
haml_engine = Haml::Engine.new(template)
haml_engine.render(Object.new)
end
end
base.haml
---------------
:javascript
= render 'button'
= render 'button'
button.haml
-----------------
= "alert('Button');"
so the problem is with when render is working as desired...
I start a Rails console/script...
>> template = File.read("#{Rails.root}/lib/targeting_templates/base.haml")
>> haml_engine = Haml::Engine.new(template)
>> haml_engine.render(Hamler.new)
=> "<script type='text/javascript'>\n //<![CDATA[\n = render
ima.downcase\n //]]>\n</script>\nalert('Button');\n"
What I don't get is why the method render from Hamler class works when
not indented? Inside the :javascript it just outputs text, not
calling Hamler.render
hmmm, what am I doing wrong?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---