我正在尝试使用Gmaps4rails在Ruby 2.4.2上的ActiveAdmin中显示地图
到目前为止,我有:
gem 'gmaps4rails', '~> 2.1', '>= 2.1.2'
gem 'underscore-rails'
在app/assets/javascripts/application.js
中:
//= require underscore
//= require gmaps/google
//= require jquery
//= require jquery_ujs
//= require_tree .
在管理员收件人模型中:
show do |recipient|
attributes_table do
# stuff
end
@markers = Gmaps4rails.build_markers(recipient) do |address, marker|
marker.lat(address.latitude)
marker.lng(address.longitude)
marker.title(address.id)
marker.infowindow(address.corrected_address)
end
div do
render "map", { markers: @markers }
end
end
在views/admin/recipients/_map.html.erb
中:
<%= stylesheet_link_tag 'gmaps4rails' %>
<%= gmaps4rails(@markers) %>
<%= yield :scripts %>
我捆绑了服务器,重新启动服务器,当我进入admin show视图时,我得到:
undefined method 'gmaps4rails' for #<#<Class:0x007fe459380370>:0x007fe4570aac60>
有人知道我在想什么吗?