In my opinion, I am trying to parse a table of objects, this is my code:
<div id='categories_show'>
<table border="1">
<tr>
<th>Categories</th>
<th>CBB's</th>
</tr>
<% for category in @critical_process.categories %>
<tr>
<td rowspan="<%= category.capability_building_blocks.size %>"><%= category.category_title %></td>
<td><%= category.capability_building_blocks.first.cbb_title %></td>
</tr>
<% (category.capability_building_blocks - category.capability_building_blocks.first).each do |cbb| %>
<tr>
<td><%= cbb.cbb_title %></td>
</tr>
<% end %>
<% end %>
</table>
</div>
however, this causes an error: can't convert CapabilityBuildingBlock into Array
the relationship is correct, the error comes from the line where I try to subtract the first array object here: <% (category.capability_building_blocks - category.capability_building_blocks.first).each do |cbb| %>
is there any way i can iterate over an array ignoring the first object in the array?
thank
user646560
source
share