title: gmaps4rails replaceMarkers not working (javascript)
body: <p><strong>stack details</strong>
  ruby 1.9.2p180,
  rails 3.0.9,
  gmaps4rails 1.0.2,
  jquery.json-2.3.min.js</p>
  
  <p><strong>Background</strong>
  I am a newbie to gmaps4rails and really like the gem. All is working well so far, but I am trying to update markers dynamically for the first time. I am doing the following in application.js:</p>
  
  <pre><code>var markers_json = $.toJSON(markers_array);
  Gmaps.map.replaceMarkers(markers_json);
  </code></pre>
  
  <p>This does not work and gives the following error</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'position' of undefined
  extendBoundsWithMarkers in gmaps4rails.googlemaps.js:204
  Gmaps4Rails.adjustMapToBounds in gmaps4rails.base.js:443
  Gmaps4Rails.create_markers in gmaps4rails.base.js:321
  Gmaps4Rails.addMarkers in gmaps4rails.base.js:389
  Gmaps4Rails.replaceMarkers in gmaps4rails.base.js:381
  </code></pre>
  
  <p><strong>Investigation done so far</strong></p>
  
  <ol>
  <li><p>Confirmed that the initial creation of the map is done by providing the markers as a json string.</p></li>
  <li><p>Confirmed that I am giving a json string of the same format in the replaceMarkers call</p></li>
  <li><p>Confirmed that in the source, when addMarkers is called on initial page load, the markers are in the form of an object array, but the replaceMarkers call (as I mentioned above) contains a JSON string</p></li>
  </ol>
  
  <p><strong>Other attempts</strong>
  Tried to pass the markers without converting to JSON</p>
  
  <pre><code>Gmaps.map.replaceMarkers(markers_array);
  </code></pre>
  
  <p>but that didn't work as well.</p>