控制器应该如何为gmaps4rails看起来像?

时间:2011-10-23 19:49:21

标签: ruby-on-rails-3.1 gmaps4rails

我的gmap上只有一个标记:

<%= gmaps({
    "map_options" => { "auto_zoom" => false, "zoom" => 3, "auto_adjust" => false},
    "markers" => { "data" => @json }
    }) %>

<% content_for :scripts do %>
  <script type="text/javascript" charset="utf-8">
    var marker = null;
    Gmaps.map.callback = function()
    {
      google.maps.event.addListener(Gmaps.map.map, "click",
      function(object)
      {
        if (marker != null) { marker.setMap(null); }
        marker = new google.maps.Marker({position: object.latLng, map: Gmaps.map.map});
      });
    };
  </script>
<% end %>

如何将标记保存到数据库?我的控制器应该怎么样?谢谢!

0 个答案:

没有答案