Mapping X-Y Coordinates from rails iteration

Mapping X-Y Coordinates from rails iteration

I've created a photo tagging system using jQuery, however once I refresh the page the tags do not show up. I created an erb iteration that goes through all the tags and finds the x-y coordinates but I'm stuck on how to display them. 

  1. <% @image.each do |image| %>
  2.           <%= image.connections.each do |conn| %>
  3.             <span class="connection" data-pos-x="<%= conn.pos_x %>"></span>
  4.             <span class="connection" data-pos-y="<%= conn.pos_y %>"></span>
  5.         <% end %>
Which returns something similar to:
  1. <span class="connection" data-pos-x="<%= conn.pos_x %>"></span>
  2. <span class="connection" data-pos-y="<%= conn.pos_y %>"></span>


So i'm wondering how I can cycle through all the connections (I think a for loop) and then plot their coordinates on to the image field. Here is the link to the  jsFiddle  with the working photo tagger. Any help would be greatly appreciated!