Ruby on rails Rails,gmaps4rails不';无法使用https
我目前正在使用Rails 3.0.9和gmaps4rails 0.8.6 我在为谷歌地图启用https时遇到问题 我试着使用这个解决方案: 但是没有成功 在布局应用程序中,我添加了以下js include标记:Ruby on rails Rails,gmaps4rails不';无法使用https,ruby-on-rails,ruby,ruby-on-rails-3,google-maps,gmaps4rails,Ruby On Rails,Ruby,Ruby On Rails 3,Google Maps,Gmaps4rails,我目前正在使用Rails 3.0.9和gmaps4rails 0.8.6 我在为谷歌地图启用https时遇到问题 我试着使用这个解决方案: 但是没有成功 在布局应用程序中,我添加了以下js include标记: <%= javascript_include_tag "https://maps.google.com/maps/api/js?sensor=false&libraries=geometry" %> <%= javascript_include_tag "ht
<%= javascript_include_tag "https://maps.google.com/maps/api/js?sensor=false&libraries=geometry" %>
<%= javascript_include_tag "https://google-maps-utility-library-v3.googlecode.com/svn/tags/infobox/1.1.5/src/infobox.js" %>
<%= javascript_include_tag "gmaps4rails.js" %>
<%= javascript_include_tag "https://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/1.0/src/markerclusterer_compiled.js" %>
看法
我试图将gmaps4rails改为gmaps
结果:
Completed 500 Internal Server Error in 54ms
ActionView::Template::Error (undefined method `to_gmaps4rails' for #<String:0xf5d98528>):
13: <script type="text/javascript" charset="utf-8">
14: function gmaps4rails_init() {
15: <% #true is passed here to trigger map initialization %>
16: <%=raw options.to_gmaps4rails(true) %>
17: }
18:
19: function gmaps4rails_loadScript() {
app/views/places/index.html.erb:4:in `_app_views_places_index_html_erb___671263203__86055108_0'
您应该升级到gem的最新版本:0.x.x中不存在Gmaps4RailsGoogle 使用1.x.x,您需要一个额外的文件:
gmaps4rails.googlemaps.js
“gmaps4rails.js”现在是“gmaps4rails.base.js”
使用安装程序,您将复制所有内容
使用gmaps帮助程序时,需要提供哈希作为第一个参数:
gmaps( :markers => { :data => @json } )
编码1.0.0时需要进行一些更改,因为现在可以在同一页上创建多个映射。无论如何,所有的文档都在维基上。
我想所有这些指示都能满足您的需要。谢谢,现在标记器可以工作了。这一行
{“data”=>@json}},true,false)%>
使谷歌地图工作得非常出色D
Completed 500 Internal Server Error in 54ms
ActionView::Template::Error (undefined method `to_gmaps4rails' for #<String:0xf5d98528>):
13: <script type="text/javascript" charset="utf-8">
14: function gmaps4rails_init() {
15: <% #true is passed here to trigger map initialization %>
16: <%=raw options.to_gmaps4rails(true) %>
17: }
18:
19: function gmaps4rails_loadScript() {
app/views/places/index.html.erb:4:in `_app_views_places_index_html_erb___671263203__86055108_0'
<div id="mapLocal"> <%= gmaps4rails(@json) %> </div>
Gmaps4RailsGoogle is not defined
Gmaps.map = new Gmaps4RailsGoogle();
gmaps4rails.googlemaps.js
gmaps( :markers => { :data => @json } )