ruby - Rails gmaps4rails Map doesn't autoadjust -


i followed gmaps4rails v2 tutorial youtube.

this happens...

enter image description here

enter image description here

enter image description here

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

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -