Hey guys, this is my first time posting in this section of Dev Shed. I am working on a Databases project at school so I decided to learn RoR.

I am trying to work on the View for one of my database tables, here is the "index.html.erb" that was generated by my scaffold I created to store pizza places:

Code:
<h1>Listing Pizza Places</h1>

<table>
  <tr>
    <th>Name</th>
    <th>OwnerName</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @pizzaplaces.each do |pizzaplace| %>

  <tr>
    <td><%= pizzaplace.name %></td>
    <td><%= pizzaplacet.ownername %></td>
    <td><%= link_to 'Show', pizzaplace %></td>
    <td><%= link_to 'Edit', edit_pizzaplace_path(pizzaplace) %></td>
    <td><%= link_to 'Destroy', pizzaplace, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New Pizza Place', new_pizzaplace_path %>
Okay so I have a map running in an adjacent <div>, what I want to do is load markers onto the map using Google Maps API V3. I hope to do this by including some sort of javascript function call inside the "each do" loop of the code (im not sure what type of code this is.. "erb" is it called a partial??? Ruby??? Rails???)

This is what I have tried... with no effect.. I have bolded the changes.


Code:
 <script type="text/javascript">

  function addMarker(Latitude, Longitude) {
    if( typeof addMarker.counter == 'undefined' ) {
          addMarker.counter = 0;
      }
    addMarker.counter++;
    
    myMarkers[addMarker.counter] = new google.maps.Marker({
          position: new google.maps.LatLng(Latitude, Longitude),
          map: map, 
          title:"test"});
   }

  </script>

<h1>Listing Pizza Places</h1>

<table>
  <tr>
    <th>Name</th>
    <th>OwnerName</th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% @pizzaplaces.each do |pizzaplace| %>
<script type="text/javascript">
        addMarker(<% pizzaplace.latitude %>, <% pizzaplace.longitude %>);   
    </script>
  <tr>
    <td><%= pizzaplace.name %></td>
    <td><%= pizzaplacet.ownername %></td>
    <td><%= link_to 'Show', pizzaplace %></td>
    <td><%= link_to 'Edit', edit_pizzaplace_path(pizzaplace) %></td>
    <td><%= link_to 'Destroy', pizzaplace, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New Pizza Place', new_pizzaplace_path %>
I hope something like this is possible, I have only a basic understanding of RoR and the embedding of JS inside html.

Thanks to anyone that decides to help...

-Paul