0

因此,我创建了一个 erb 迭代,它迭代多个产品,生成相应的产品图像和位于图像顶部的 div (.tagged)。问题是当只有一个输出连接 (i_connection) 时没有显示 div,但是当有多个时,会显示正确数量的 div。知道这里发生了什么吗?

<% if @new_manual.present? %>
  <% @new_manual.steps.each do |step| %>

    <% i_connection = Contact.find(step.input_contact) %>
    <span class="connection" data-pos-x="<%= i_connection.pos_x %>" data-pos-y="<%= i_connection.pos_y %>"  data-pos-width="<%= i_connection.pos_width %>" data-pos-height="<%= i_connection.pos_height %>"></span>

    <% o_connection = Contact.find(step.output_contact) %>
    <% cord = CordType.find(step.contact_item) %>

    <%= o_connection.product.full_name %>
    uses a <%= cord.name %>
    to plug into <%= i_connection.product.full_name %><br>
    <%= image_tag(o_connection.image.image.url(:medium)) %>

    <br>
    <%= image_tag(cord.image.url(:thumb)) %><br>
    <br>
    <div id='image_panel'>
      <%= image_tag(i_connection.image.image.url(:medium)) %>
      <div id='planetmap'></div>
    </div>

    <%= image_tag(cord.image.url(:thumb)) %>
  <% end %>
<% end %>
4

0 回答 0