Search code examples
ruby-on-rails-4gmaps4railsgmaps4rails2

Custom images not working in new gmaps4rails v2


Migrate gmaps4rails v1 to v2 (great gem!). But i cannot get the custom marker images only the default one.

output code:

handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
                          markers = handler.addMarkers([{"lat":43.3851,"lng":12.3856,"picture":{"picture":"/assets/house.png","width":"32","height":"32"},"title":"blablabla"} 

controller

@locations = Location.where(:region => @region.id)

    @hash = Gmaps4rails.build_markers(@locations) do |location, marker|
       marker.lat location.latitude
       marker.lng location.longitude
       marker.infowindow location.description
       marker.picture({
       "picture" => "/assets/house.png",
       "width" =>  "32",        
       "height" => "32"
       })
       marker.json({:title => location.description})
    end

If you look ate the output the code works...but i don't see the custom marker house.png.

Am i doing something wrong here? Security issue?

Thanks..remco


Solution

  • You're simply not following the doc/examples, use:

     marker.picture({
       "url" => "/assets/house.png",
       "width" =>  "32",        
       "height" => "32"
     })