0

将 gmaps4rails v1 迁移到 v2(伟大的宝石!)。但我不能只获得默认的自定义标记图像。

输出代码:

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"} 

控制器

@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

如果您查看输出,则代码有效……但我没有看到自定义标记 house.png。

我在这里做错了吗?安全问题?

谢谢..remco

4

1 回答 1

2

您根本没有遵循文档/示例,请使用:

 marker.picture({
   "url" => "/assets/house.png",
   "width" =>  "32",        
   "height" => "32"
 })
于 2014-05-27T20:39:15.803 回答