@hash = Gmaps4rails.build_markers(@additional_infos) do |additional_info, marker|
marker.lat additional_info.latitude
marker.lng additional_info.longitude
marker.picture({
"picture" => view_context.image_path('/qr-code-icon.png'),
"width" => 32,
"height" => 37
})
end
这是我控制器的索引动作。地图显示正常标记,但我似乎无法显示自定义标记。我尝试过多种不同的网址和链接到图标的方法,但没有运气。
我试过"url" = > #{root_url} , http localhost etc..
拉我的头发
答案 0 :(得分:2)
您必须使用“url”哈希键而不是“picture”
@hash = Gmaps4rails.build_markers(@additional_infos) do |additional_info, marker|
marker.lat additional_info.latitude
marker.lng additional_info.longitude
marker.picture({
"url" => view_context.image_path('/qr-code-icon.png'),
"width" => 32,
"height" => 37
})
end
答案 1 :(得分:0)
@hash = Gmaps4rails.build_markers(@members) do |member, marker|
marker.lat member.latitude
marker.lng member.longitude
marker.infowindow member.name
marker.picture({
:url => view_context.image_path('marker.png'),
:width => 32,
:height => 37
})