そこで、各画像タグ (「.tagged」) の座標を反復処理し、指定された座標で各画像の「.tagged」を表示する erb ブロックを作成しました。この特定のケースでは、ブロックは 2 つの画像を繰り返し処理し、尊重される画像ごとに 1 つのタグではなく、両方の画像に .tagged が表示されます。これは .each() メソッドによるものですか?
<div class="container">
<% if @new_manual.present? %>
<% @new_manual.steps.each do |step| %>
<% i_connection = Contact.find(step.input_contact) %>
<span class="i_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>
<br>
<div class="image_panel">
<%= image_tag(i_connection.image.image.url(:large)) %>
<div class='planetmap'></div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("span.i_connection").each(function() {
var pos_width = $(this).data('pos-width');
var pos_height = $(this).data('pos-height');
var xpos = $(this).data('pos-x');
var ypos = $(this).data('pos-y');
$(".tagged_box").css("display","block");
$(".tagged").css("border","5px solid red");
$('.planetmap').append('<div class="tagged" style="width:'+pos_width+'px;height:'+pos_height+'px;left:'+xpos+'px;top:'+ypos+'px;" ><div class="tagged_box" style="width:'+pos_width+'px;height:'+
pos_height+'px;" ></div>')
}); //END OF SPAN.CONNECTION ITERATION
}); //END OF JQUERY
</script>
<% end %>
<% end %>
</div>