# Table trouble

**URL:** <https://www.ruby-forum.com/t/table-trouble/151236>\
**Category:** Rails\
**Created:** [October 18, 2008, 6:15pm UTC](https://www.ruby-forum.com/t/table-trouble/151236 "2008-10-18T18:15:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/db5fbb/32.png) [@alex](https://www.ruby-forum.com/u/alex)\
**Post date:** [October 18, 2008, 6:15pm UTC](https://www.ruby-forum.com/t/table-trouble/151236/1 "2008-10-18T18:15:07Z")

</div>

Guys, I need your awesome help again.

I have two models - FlightType and FlightTypeCategory. FlightType  
belongs\_to FlightTypeCategories. I want to present these in a table,  
the categories spanning over the flighttypes, like this:

| Flight Category 1 | Flight Category 2 |
| --- | --- |
| Flight Type 1 | Flight Type 2 | Flight Type 3 | Flight Type 4 | Flight Type 5 |

You probably get it. The problem is - the user can show/hide the  
flight types to his/her liking. So the flight type categories will  
have dynamic colspans, if visible at all.

I’m completely stuck here. I have @flight\_types, which calls  
FlightTypes.visible, and returns an array of the visible flight types.  
But I can’t seem to figure out how to run this to fetch the  
corresponding flight type categories.

I hope I’ve made my issue clear. Any ideas?
