# Having trouble with link breaks in a table

**URL:** <https://www.ruby-forum.com/t/having-trouble-with-link-breaks-in-a-table/193888>\
**Category:** Rails\
**Created:** [August 26, 2010, 8:39am UTC](https://www.ruby-forum.com/t/having-trouble-with-link-breaks-in-a-table/193888 "2010-08-26T08:39:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [August 26, 2010, 8:39am UTC](https://www.ruby-forum.com/t/having-trouble-with-link-breaks-in-a-table/193888/1 "2010-08-26T08:39:01Z")

</div>

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

 \<%= render :partial=\>"christmas", :collection =\> @single %\>

| Single Families |
| --- |

\_christmas.html.erb

\<%= h(christmas.name) %\>

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

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [August 26, 2010, 3:21pm UTC](https://www.ruby-forum.com/t/having-trouble-with-link-breaks-in-a-table/193888/2 "2010-08-26T15:21:31Z")

</div>

Bob S. wrote:

> views:  
> christmas.html.erb
> 
> \<%= render :partial=\>"christmas", :collection =\> @single %\>
> 
> | Single Families |
> | --- |

Perhaps something like:

 \<%= render :partial =\> "christmas", :collection =\> @single %\>

| Single Families |
| --- |

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [August 26, 2010, 12:23pm UTC](https://www.ruby-forum.com/t/having-trouble-with-link-breaks-in-a-table/193888/3 "2010-08-26T12:23:14Z")

</div>

On 26 August 2010 07:38, Bob S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> end
> 
> \<%= h(christmas.name) %\> [...]

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 tag is for there.

Colin

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [August 26, 2010, 8:30pm UTC](https://www.ruby-forum.com/t/having-trouble-with-link-breaks-in-a-table/193888/4 "2010-08-26T20:30:20Z")

</div>

On Aug 26, 9:21 am, Ar Chron [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> \<%= render :partial =\> "christmas", :collection =\> @single %\>
> 
> | Single Families |
> | --- |
> 
> -- Posted viahttp://www.ruby-forum.com/.

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

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [August 26, 2010, 9:06pm UTC](https://www.ruby-forum.com/t/having-trouble-with-link-breaks-in-a-table/193888/5 "2010-08-26T21:06:34Z")

</div>

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.
