Having trouble with link breaks in a table

I have table being filled by a partial. When the fields are filled, the fields end up together or not there for half a page. See below. My controller code and views are below..

controller:     @single = Array.new     for @h in households do       if @h.people.count == 1           @single << @h       end     end

views: christmas.html.erb <table border=1 width="25%">   <th>Single Families</th>   <col>   <%= render :partial=>"christmas", :collection => @single %> </table>

_christmas.html.erb <tr><td><%= h(christmas.name) %></td></tr>

The output is:

  Single Families Amanda Axxrn Paula xxxk Michael BxxxxRxxond Baxxt Carl Lxxxe Bexx Robert BxxxxxrdBetsy xxxxxuJason BrxxxnKeith Bxxxn Frances Brxxxle Edward BxxxkDoris BxxxrThomas CxxxllEdith Cxxxxy Sandra DxxxxxtSuzanne DxxxxxultJoyce Dxxxk Frances Dxxxxn Barbara DxxxdyRita DxxxxinVirginia Dxxxis Donald Exxxy Lorraine ExxxxElsie FxxxufEvelyn Fxxxnd Patricia Fxxxxy Romeo Fxxx Cheryl FxxerAlice Frxxxe

Rita Gxxs

Firstly have a look at the generated html (View, Page Source or similar in the browser) and see if it is what you expect. If it looks ok then copy and paste it into the w3c html validator (google for it) to check it is valid. See if that shows anything.

I am not sure what the <COL> tag is for there.

Colin

Bob Smith wrote:

views: christmas.html.erb <table border=1 width="25%">   <th>Single Families</th>   <col>   <%= render :partial=>"christmas", :collection => @single %> </table>

Perhaps something like:

<table border=1 width="25%">   <tr>     <th>Single Families</th>   </tr>   <%= render :partial => "christmas", :collection => @single %> </table>

No change. It uses the top half of the page to print, then skips the bottom half. Still doesn't use the cell size either. Another table in the same controller action and same view works fine. While I was messing with this, the only thing that made the cells line up with no skips was to put the name field three times so it used the entire width of the page. Hope this helps.

Bob

Bob

I wonder if internally (in Rails) something is getting confused between your view name (christmas.html.erb) and the partial name (_christmas.html.erb).

What if you rename your partial to something like _christmas_row.html.erb?

And if there is another table in the same view, it might be that your generated html is not closing properly before attempting to generate the christmas table...

Feel free to post the view in its entirety, because the solution *should* be relatively simple.