V2中具有Active Admin的Gmaps4rails:类的未定义方法'gmaps4rails'

时间:2018-10-03 20:34:04

标签: ruby-on-rails activeadmin gmaps4rails

我正在尝试使用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>

有人知道我在想什么吗?

0 个答案:

没有答案