Forum: Ruby on Rails Table trouble

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Alex J. (Guest)
on 2008-10-18 20:15
(Received via mailing list)
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:

<table>
<tr>
<th colspan="2">Flight Category 1</th>
<th colspan="3">Flight Category 2</th>
</tr>
<tr>
<td>Flight Type 1</td>
<td>Flight Type 2</td>
<td>Flight Type 3</td>
<td>Flight Type 4</td>
<td>Flight Type 5</td>
</tr>
</table>

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?
This topic is locked and can not be replied to.