Try this:
def haml(&block)
return capture_haml(&block) if is_haml?
init_haml_helpers
yield
@haml_is_haml = false
@haml_stack.pop.buffer
end
No guarantees, but that should work.
- Nathan
Lakshan wrote:
> I tried to use HAML in my view helpers and I found that if it breaks
> the "form_for" tags which comes after that. It seems the output of
> form_for is being written to HAML:Buffer. Anyone knows a method to
> return the control back to ERB from HAML after helpers ?
>
> My Helper code is as follows :
>
> def haml
> # needed to use haml with erb
> unless is_haml?
> init_haml_helpers
> end
>
> capture_haml do
> yield
> end
>
> end
>
> def links_bar
> haml do
> open :p do
> open :span, link_to("About", "#")
> open :span, link_to("Contact", "#")
> end
> end
> end
>
> My ERB template (snippet) :
>
> <%= links_bar %>
> <% form_for :cart, @cart, :url => cart_path(params[:id]), :html =>
> { :class => 'validated', :method => 'put' }, :builder =>
> CssFormBuilder do |form| %>
> --
> --
> <% end %>
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---