EDIT:
Поскольку v1.0.0
, добавить несколько карт на одну и ту же страницу действительно просто, см. Вики .
Это не очень прямо, так как мне это не нужно, но это можно сделать довольно легко.
first map here, it triggers the load of the necessary js files.
<%= gmaps4rails (@json1) %>
/the empty divs for second map (beware to provide the proper css)
<div id="second_container">
<div id="second_map"></div>
</div>
<% content_for :scripts do %>
<script>
var counter = 0;
Gmaps4Rails.callback = function() {
if (counter == 0){
counter += 1;
<%= { "map_options" => {
"container_id" => "second_container", "id" => "second_map",
"type" => "SATELLITE", "center_longitude" => 180, "zoom" => 3, "auto_adjust" => true
},
"markers" => { "data" => @json2 }
}.to_gmaps4rails(true).html_safe
%>
}
};
<script>
<% end %>