I have a nested model (exptype), and I'm using bootstrap tabs to show the has_many relationship between the parent (experiment) and it's children (exptype).
So far my code looks like:
<div role="tabpanel">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<% @experiment.exptypes.each do |e| %>
<li role="presentation"><a href="#exptype<%=e.id%>" aria-controls="exptype<%=e.id%>" role="tab" data-toggle="tab"><%=e.get_name%></a></li>
<% end %>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<%= f.fields_for :exptypes do |builder| %>
<div role="tabpanel" class="tab-pane" id="exptype<%=builder.object.id%>">
<%=builder.object.id%>
</div>
<% end %>
</div>
</div>
The tabs themselves work. But the tab-content does not. What happens is for each tab, all the builder.object.id's are shown in each tab, and not in their respective ones.
I believe it's the fields_for loop that is causing the problem. However, I want to be able to have a tab that allows for the addition of a new exptype.