Take the 2-minute tour ×

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

enter image description here

I need to add different marker images for the each of them. How can this be done. please help.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
Doesn't it answer? –  apneadiving May 2 '12 at 17:49
Yes.. thanks a lot :) –  Amal Kumar S May 4 '12 at 5:56
I have same problem, can you share solution? –  Иван Бишевац Aug 27 '13 at 20:08

Your Answer


