I need to show two different markers in my Google map. I am using rails 3 and Gmaps4rails gem.
I my controller I have
@marker1 = User.find(1)
@marker2 = User.find(2)
@json = [@marker1,@marker2].to_gmaps4rails
In view file
<%= gmaps({
"map_options" => { "zoom" => 12, "auto_adjust" => false, "center_latitude" => @marker1.lat, "center_longitude" => @marker1.lng},
"markers" => { "data" => @json }
})
%>
<%= yield :scripts %>
The map view I get is
I need to add different marker images for the each of them. How can this be done. please help.
I have simply one answer: it's explained in the wiki, within the Customize each marker
section.
There is also some alternative to add the styles in a block from your controller instead of model level.