Gmaps is not defined in rails 4 + gmaps4rails 2.0.3

前端 未结 1 347
余生分开走
余生分开走 2021-01-20 05:21

Gmaps4rails is not define in rails 4.0.0 Google Maps for Rails i am following this tutorial \"http://rubydoc.info/gems/gmaps4rails/2.0.4/frames\"

1) Gemfile
         


        
1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-20 06:12

    I ran into this issue. The problem was that I was loading the map building javascript in the view before I was loading the core gmaps javascript.

    You can solve this by add a yield after your javascripts, and using a content_for block to place your map building javascript after the others. Something like this:

    
        
    <%= javascript_include_tag "application", "data-turbolinks-track" => true %>  
    <%= yield :javascripts %>
    

    and then, wherever you're building your map,

    <% content_for :javascripts do %>
    
    <% end %>
    

    0 讨论(0)
提交回复
热议问题