0
该文档指出,使用Google地图时不需要提供商密钥。不过,我想要使用我的Google API密钥,以便我可以跟踪我的使用情况。Rails 3.1的gmaps4rails gem是否允许使用Google Maps API密钥?
从gem中的_scripts.html.erb文件看来,没有内置支持在Google地图上使用provider_key。是对的吗?
<% if enable_js == true && scripts.try(:to_sym) != :none %>
<% case map_options.try(:[], :provider) %>
<% when "openlayers" %>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<% when "mapquest" %>
<script src="http://mapquestapi.com/sdk/js/v6.0.0/mqa.toolkit.js?key=<%= map_options.try(:[], :provider_key) %>"></script>
<% when "bing" %>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<% else %>
<script type="text/javascript" src="//maps.google.com/maps/api/js?v=3.5&sensor=false&libraries=geometry<%= gmaps4rails_js_libraries(map_options.try(:[], :libraries)) %>"></script>
<script type="text/javascript" src="//google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.9/src/infobox_packed.js"></script>
<script type="text/javascript" src="//google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.0.5/src/markerclusterer_packed.js"></script>
<script type="text/javascript" src="//google-maps-utility-library-v3.googlecode.com/svn/trunk/richmarker/src/richmarker-compiled.js"></script>
<% end %>
<% if Rails::VERSION::MAJOR >= 3 && Rails::VERSION::MINOR < 1 %>
<% unless scripts.try(:to_sym) == :api %>
<%= javascript_include_tag 'gmaps4rails/gmaps4rails.base.js' %>
<% end %>
<% case map_options.try(:[], :provider) %>
<% when "openlayers" %>
<%= javascript_include_tag 'gmaps4rails/gmaps4rails.openlayers.js' %>
<% when "mapquest" %>
<%= javascript_include_tag 'gmaps4rails/gmaps4rails.mapquest.js' %>
<% when "bing" %>
<%= javascript_include_tag 'gmaps4rails/gmaps4rails.bing.js' %>
<% else %>
<%= javascript_include_tag 'gmaps4rails/gmaps4rails.googlemaps.js' %>
<% end %>
<% end %>
<% end %>
如果是,是否有计划添加对Google地图提供商密钥的支持?还是我最好只是在自己的黑客攻击? :-P