如何使用适用于 Rails 的 PostGIS 适配器保存多边形?在我的模型中,我有:
self.rgeo_factory_generator = RGeo::Geos.factory_generator
set_rgeo_factory_for_column(:bounds, RGeo::Geographic.spherical_factory(:srid => 4326))
但是当我尝试将多边形保存到数据库时,它不会引发任何错误,但总是无法存储多边形:
1.9.3p194 :011 > n.bounds = "POLYGON(-149.737965876574 61.1952881991104, -149.71848377896 61.1953198415937, -149.718483761252 61.1952938698801, -149.718483872402 61.1951924591105)"
=> "POLYGON(-149.737965876574 61.1952881991104, -149.71848377896 61.1953198415937, -149.718483761252 61.1952938698801, -149.718483872402 61.1951924591105)"
1.9.3p194 :012 > n.save
(0.2ms) BEGIN
(0.3ms) COMMIT
=> true
1.9.3p194 :013 > n.bounds
=> nil
我怎样才能让它工作?