3
gmaps4rails v2로 업그레이드 중입니다. javascript에서 json 속성에 액세스 할 수 없습니다. 마커에서 json 속성에 액세스 - gmaps4rails
@hash = Gmaps4rails.build_markers(@users) do |user, marker|
marker.lat user.latitude
marker.lng user.longitude
marker.json({link: "someurl", current: true})
end
그리고 자바 스크립트 User.all
@users = :handler = Gmaps.build('Google');
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
markers = handler.addMarkers(<%=raw @hash.to_json %>);
console.log(markers[0].link);
console.log(markers[1].current);
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
});
>undefined
>undefined
이것은 내가 컨트롤러 (1.5.6)
특히
Buidling를 사용하던 이전 버전에서 일
감사합니다.
덕분에 빠른 응답 – cgat
당신은 환영합니다 위해! stackoverflow에 눈을 떼지 않도록 1.x 사용자에게는 고통 스러울 수 있습니다. :) – apneadiving