Search code examples
jqueryajaxruby-on-rails-3google-mapsgmaps4rails

calling gmaps4rails map in rails 3.1 inside an ajax-activated partial


I've been using the gmaps4rails gem for a while in rails 3.1 and it works great for straight-up loading of maps on normally-rendered pages. but when i try to load the same map inside an ajax-activated partial, it only gives me an empty box. i have seen a few SO responses to similar questions, but none are getting me to a working solution. I know that i'm missing something to trigger the call for the map, but i'm not sure what this should be or where this should go. on initial load the page has all the normal and necessary js loaded, but when i activate an ajax partial, the following gives me an empty div:

        <%= gmaps4rails(@json) %>  
        <%= @json %> (this is just to check valid json is being sent through)   

(the same code, when called in the 'main' body of the page, works fine)

any pointers?


Solution

  • Just created a gist.

    Does it answer?