ruby - Rails gmaps4rails Map doesn't autoadjust -
i followed gmaps4rails v2 tutorial youtube.
this happens...
explanation: randomly when access view, shows maps partially , if move maps mouse (as first 2 pictures) never fills field... after n tries (just pressing f5...) displays correctly (third picture) later page reloading, it's first pictures. need know happening.
view:
<div style='width: 600px;'> <div id="map" style='width: 600px; height: 300px;'></div> </div> <script type="text/javascript"> handler = gmaps.build('google'); handler.buildmap({ provider: {}, internal: {id: 'map'}}, function(){ markers = handler.addmarkers(<%=raw @hash.to_json %>); handler.bounds.extendwith(markers); //handler.fitmaptobounds(); handler.getmap().setzoom(15); handler.map.centeron(marker); }); </script>
controller:
@hash = gmaps4rails.build_markers(@users) |user, marker| marker.lat user.latitude marker.lng user.longitude end
model:
class user < activerecord::base geocoded_by :current_sign_in_ip after_validation :geocode end
i've tried setzoom , fitmaptobounds nothing changes... followed tutorial , github's guide.
update:
how show users @ map in other model different user model?
Comments
Post a Comment