自定义图像无法在新的gmaps4rails v2中使用

时间:2014-05-27 20:32:09

标签: ruby-on-rails-4 gmaps4rails gmaps4rails2

将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。

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

Thanks..remco

1 个答案:

答案 0 :(得分:2)

您只是不遵循doc / examples,请使用:

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