title: How to put rails data into a javascrip array
body: <p>I have a collection of data coming from rails db but I want to convert it into a js array.</p>
  
  <p>The array below is static, so I want to take the value of latitude and longitude from my rails application and convert it into an array like the one bellow. </p>
  
  <pre><code>var locations = [
          {lat: -31.563910, lng: 147.154312},
          {lat: -33.718234, lng: 150.363181},
          {lat: -33.727111, lng: 150.371124},
          {lat: -33.848588, lng: 151.209834},
          {lat: -33.851702, lng: 151.216968},]
  </code></pre>
  
  <p>I tried : </p>
  
  <pre><code>var locations = &lt;%= raw @locations.to_json %&gt;;
  </code></pre>
  
  <p>But it brings even what I don't need!</p>