title: rails send database vlaue to javascript
body: <p>I have the following javascript code in rails 3.2.</p>
  
  <blockquote>
    <p>
          function initialize() {
            var myLatLng = new google.maps.LatLng(34.553366482, 49.783977595);
            var mapOptions = {
              zoom: 12,
              center: myLatLng,
              mapTypeId: google.maps.MapTypeId.TERRAIN
            };</p>
  </blockquote>
  
  <pre><code>    var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
  
      var flightPlanCoordinates = [
          new google.maps.LatLng(34.553366482, 49.783977595),
          new google.maps.LatLng(34.554122088, 49.783895487),
          new google.maps.LatLng(34.554483305, 49.783853715),
          new google.maps.LatLng(34.555332372, 49.783720553),
  
          new google.maps.LatLng(34.556189752, 49.783658072),
          new google.maps.LatLng(34.556664709, 49.783605137),
          new google.maps.LatLng(34.556769403, 49.783602219),
          new google.maps.LatLng(34.556787772, 49.783469404),
  
          new google.maps.LatLng(34.556793727, 49.783317126),
          new google.maps.LatLng(34.555050604, 49.783479752),
          new google.maps.LatLng(34.554290633, 49.783555281),
          new google.maps.LatLng(34.55376046, 49.783620191),
  
          new google.maps.LatLng(34.553413552, 49.783659434),
          new google.maps.LatLng(34.553275583, 49.783705246),
          new google.maps.LatLng(34.553366482, 49.783977595),
  
      ];
      var flightPath = new google.maps.Polyline({
        path: flightPlanCoordinates,
        strokeColor: '#FF0000',
        strokeOpacity: 1.0,
        strokeWeight: 2
      });
  
      flightPath.setMap(map);
    }
  
  &lt;/script&gt;
  </code></pre>
  
  <blockquote>
    <p></p>
  </blockquote>
  
  <p>this is a way o show points on the google maps. I wanna get the points from database and send to javascript. how can i do that in a loop?</p>