#4 √ resolved
tobiash

merb_helpers incompatible with haml

Reported by tobiash | February 9th, 2008 @ 06:59 PM

I noticed that the current merb_helpers have a problem with haml: In tag_helpers.rb, there is

    # Provides direct acccess to the buffer for this view context
    def _buffer( the_binding )
      @_buffer = eval( "_buf", the_binding )
    end

which does not work with haml cause there is no "_buf" method. Changing it to

    # Provides direct acccess to the buffer for this view context
    def _buffer( the_binding )
      @_buffer = eval( "buffer.buffer", the_binding )
    end

makes it work with Haml, but probably causes problems with erb and markaby.

Comments and changes to this ticket

  • Aaron Wheeler

    Aaron Wheeler February 27th, 2008 @ 02:35 PM

    I, too, am noticing incompatibilies with HAML and merb_helpers. I'm on these revisiongs:

    merb_helper: 6996c4bc9fbf4adf50e2d5380cea5f47286eb7a5

    merb-haml: de0d12388033602db210399afd209b2aab6e3b61

    I get the error that buffer is not defined for # (which I take to mean the_binding).

    The error happens when I have a call to #form_for within a HAML partial.

    For example: show.html.haml

     = partial :form
    
    _form.html.haml
    
    
    • @blog = Blog.new
    • form_for( :blog, :action => '/blogs/create' ) do

    = text_control( :title, :label => 'title' )

    I found that replacing buffer.buffer with @haml_stack.last.buffer will make things work.

    merb-haml/lib/merb-haml/template.rb

  • Aaron Wheeler

    Aaron Wheeler February 27th, 2008 @ 02:40 PM

    Pardon the last malformed code snippets (and forgive me if this doesn't work either):

    show.html.haml

  • Aaron Wheeler

    Aaron Wheeler February 27th, 2008 @ 02:42 PM

    Okay, patch attached instead.

    But it feels wrong to be mucking about an instance variable array to get access to the HAML buffer. Isn't there a better way to gain access to it?

  • Thomas Reynolds

    Thomas Reynolds February 27th, 2008 @ 10:24 PM

    I spoke with wycats on #merb about this and we thought we had resolved it, but I was mistaken. I had code in my local git repository that was fixing the problem and the patch he attempted did not actually rectify the situation.

    So... here's hoping this gets committed :)

  • Ezra Zygmuntowicz

    Ezra Zygmuntowicz March 25th, 2008 @ 02:49 AM

    • → State changed from “new” to “resolved”

    this has been fixed

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

Attachments