Remove Gmap marker using YM4R

Hello,
I’m using http://ym4r.rubyforge.org and I have a problem with removing
existing marker. I tried this (.rjs file):

if @params[:gobject] == "on"
  @gobject_results.each {|marker| page << @map.addOverlay(marker)}
else
  @gobject_results.each {|marker| page << @map.removeOverlay(marker)}
end

but it doesn’t work (I mean it only adds marks). I read on google maps
API forums, that I need to have array of marks which was added, to
remove them later.
Please help me write this .js code in .rjs file:

var MarkersArray = [];  // global

var marker = new GMarker(PointsArray[Counter]);
// Adding:
map.addOverlay(marker);
MarkersArray[Counter] = marker;

// So I can remove a marker with:
map.removeOverlay(MarkersArray[Counter]);

Thank you in advance,
Stan

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs