1
I’m having a doubt.
I send the table I already made, but I have a problem in the case of "Isolate's name" "catx"
have two "gene's name" associado, "catxx" e o "catxxx"
, but I’m putting the two in the same line and I’d like to duplicate the line, one for the "catxx" and one for the "catxxx". As I do, I’m not finding the solution. The code I have is:
<tbody>
<% if @resists.any? == true%>
<% @resists.each do |resist| %>
<tr>
<td><%= resist.isolated.organism.tax_org if resist.isolated%>
<td><%= resist.isolated.organism.name if resist.isolated%>
<td><%= resist.isolated.name if resist.isolated%>
<td><%= resist.isolated.disease if resist.isolated%>
<td><%= resist.drug.name%>
<td><%= resist.drug.reference%>
<td><%= resist.drug.atc%>
<td><%if resist.isolated %>
<% @genes.each do |gene| %>
<%if resist.isolated.id == gene.isolated_id%>
<%= gene.name%>
<%end%>
<%end%>
<%end%>
</td>
@genes, get all the genes.
I’m making
<% @genes.each do |gene| %>
<%if resist.isolated.id == gene.isolated_id%>
<%= gene.name%>
<%end%>
<%end%>
because an isolate can have several genes, and as such, if I do so Resist.isolated.gene.name will give me error because it has more than one. But as I’m doing, it puts all the genes in that isolate in the same line, and I wanted to put each gene in a different line, doubling the isolate, of course. For example:
123 xpto catx cenas12 navnav 2111 catxx
123 xpto catx cenas12 navnav 2111 catxxx