Ruby on rails RubyonRails映射未显示
我已经更新了我的gemfile,包括geocoder和gmaps4rails,并遵循版本2教程,它加载了页面,但没有地图。我不知道为什么会这样 application.jsRuby on rails RubyonRails映射未显示,ruby-on-rails,google-maps,gmaps4rails,Ruby On Rails,Google Maps,Gmaps4rails,我已经更新了我的gemfile,包括geocoder和gmaps4rails,并遵循版本2教程,它加载了页面,但没有地图。我不知道为什么会这样 application.js // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require underscore
//= require gmaps/google
//= require_tree .
字符控制器文件
class CharactersController < ApplicationController
before_action :set_character, only: [:show, :edit, :update, :destroy]
# GET /characters
# GET /characters.json
def index
@characters = Character.all
#json = Character.all.to_gmaps4rails
@hash = Gmaps4rails.build_markers(@characters) do |character, marker|
marker.lat character.latitude
marker.lng character.longitude
end
end
我还做了捆绑包更新和捆绑包安装,多次重启服务器。我错过什么了吗
请告知@apreading您如何在视图中调用地图?handler=Gmaps.build'Google';handler.buildMap{provider:{},internal:{id:'map'}},函数{markers=handler.addMarkers;handler.bounds.extendWithmarkers;handler.fitMapToBounds;};是否创建下划线.js文件?你应该从下载,我检查了你所有的代码并在我的服务器上正常工作嘿,我得到了工作。。。谢谢。。。。我丢失了一个结束脚本标签。。。。如果他们不再感兴趣,就把你的问题删掉