Why is my html getting mal-formed?

Posted by alkaloids on Stack Overflow See other posts from Stack Overflow or by alkaloids
Published on 2010-04-02T06:33:18Z Indexed on 2010/04/02 7:13 UTC
Read the original article Hit count: 354

Filed under:
|

I have the following table in a form that's embedded in a formtastic form (semantic_form_for). Everything I ask to be generated by ruby shows up, but the table gets badly mangled (essentially, the tags NEVER get formed.

The table headers get drawn correctly

There are 14 available_date objects that get passed, and they alternate between having a time value of 1 or 2, so this is just terribly boggling, but probably simple to fix...

<table class="availability_table">
    <tr>
        <th>Date</th>
        <th>Early</th>
        <th>Late</th>
    </tr>
    <% f.fields_for :available_dates do |ad| %>
        <% if ad.object.time == 1  #if this is an early shift, then start the new row %>
            <tr><td><%= ad.object.date.strftime('%a, %b %d, %Y') %></td>
                <td><%= ad.collection_select(:availability , LookupAvailability.all.collect, :id, :name) %></td>
        <% else #otherwise end the row with just a box%>
            <td><%= ad.collection_select(:availability , LookupAvailability.all.collect, :id, :name) %></td></tr>
        <% end %>
    <% end %>
</table>

So like I said, the form functions properly, and the objects all get updated and displayed correctly and all that, it's just that the HTML isn't getting echo'd out properly so my table is all mangled. Help!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby