title: Gmaps4rails : How to change appearance of marker when user clicks link in sidebar?
body: <p>I'm trying to get this behavior with gmaps4rails :
  User clicks link in the sidebar, corresponding marker on the map changes image/color in order to make the selected one stand out from the others.</p>
  
  <p>I've tried with this code</p>
  
  <pre><code>Gmaps.map.callback = function(){
          var len = Gmaps.map.markers.length;
          for(var i = 0; i &lt; len; i++){
              marker = Gmaps.map.markers[i];
              google.maps.event.addListener(marker.serviceObject, 'click', (function(i){
                  return function(){
                      console.log($(Gmaps.map.markers[i].serviceObject.ne.ga).attr("src", "/assets/marker_sprite2.png"));
                  }
              })(i));
          }
      }
  </code></pre>
  
  <p>But this changes every marker's appearance, which is not very useful for what I'm trying to do !</p>
  
  <p>Is there anyway to achieve this ?</p>
  
  <p>EDIT : Made it work see answer below</p>
  
  <p>EDIT 2 : While this solution worked for what I wanted, I stumbled upon an other issue with this method, see comment to answer below</p>