I need my map to be populated with points, these have the specific lat and long. I made iteration loops but always only returns the last record.
<script>
function initMap() {
<% @units.each do |unit|%>
var map = new google.maps.Map(document.getElementById('map'), {
center: {
lat: <%=unit.coordinates[:latitude] %>,
lng: <%=unit.coordinates[:longitude] %>
},
scrollwheel: false,
zoom: 8
});
<%unit.coordinates do |u|%>
var marker = new google.maps.Marker({
title: "<%=unit.name %>",
map: map,
position: new google.maps.LatLng({
lat: <%=u[1] %>,
lng: <%=u[1] %>
}),
});
var infowindow = new google.maps.InfoWindow(),
marker;
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent("<%unit.schedules.each do |h|%> <%=h[:day]%> <%=h[:start]%> <%=h[:end]%><%end%>");
infowindow.open(map, marker);
}
})(marker))
<%end%>
<% end %>
};
Show this error when I run this code
GET http://localhost:3000/vendor/jquery/jquery.min.js [HTTP/1.1 404 Not Found 148ms]
That does not find jquery but this works normally in other parts of the code.