0

我正在使用茧宝石来处理多边形地图坐标。

class Polygon < ActiveRecord::Base
  has_many :coordinates, :dependent => :destroy
  accepts_nested_attributes_for :coordinates
end

class Coordinate < ActiveRecord::Base
  attr_accessible :latitude, :longitude, :polygon_id
  belongs_to :polygon
end

我有一个允许向多边形模型添加多个坐标并保存它的表单,它可以手动工作。

现在我正在使用谷歌地图绘图库来获取地图上的点,我被困在如何调用茧从回调中动态地将这些点插入到页面上的表单中。谷歌地图发送“覆盖完成”事件,在那个回调中,我有完整的点数组。

我应该如何做到这一点?

4

0 回答 0