Guys,

I ran across something today I'm not sure haml can handle, and I'd
really appreciate any guidance you can offer me.

We're converting our erb over to haml and enjoying it so far. However,
we have a form that places fields within the same td into to different
contexts with fields_for. Additionally, follow on tds are in the
second context. So, in erb, it looks like this:

<% form_for @obj do |a| %>
<table>
  <tr>
    <td>
       <%= a.label :name %>
       <%= a.text_field :name %>
       <% fields_for :address, @address do |b| %>
         <%= b.label :street %>
         <%= b.text_field :street %>
   </td>
   <td>
     <%= b.label :city %>
     <%= b.text_field :city %>
   </td>
  </tr>
</table>
  <% end %>
<% end %>

This example is very contrived and not the real example, but you get
the idea. Translated to haml, this becomes:

- form_for @obj do |a|
  %table
    %tr
      %td
        = a.label :name
        = a.text_field :name
        - fields_for :address, @address do |b|
          = b.label :street
          = b.text_field :street
      %td
        = b.label :city
        = b.text_field :city

See the problem? Introducing a block within a %td, that should really
transcend %tds breaks haml's assumptions here, I think. If I indent
the second %td to be within the - fields_for block, haml thinks it's a
td nested within a td. It's not.

I'm not sure this is even possible in haml, although I think there are
occasionally valid reasons to do this.

Can anyone help?

Thanks!
John

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to h...@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to