问题
90% 确定这是我的设置错误,但我无法执行 self.factory 并尝试访问 lonlat 给了我一个异常“nil:NilClass 的未定义方法‘点’”
我可以
设置 lonlat 使用:
mfactory = RGeo::ActiveRecord::SpatialFactoryStore.instance.factory(:geo_type => 'point')
self.lonlat = mfactory.point(long, lat)
self.save
这给了我0101000020E610000061C3D32B65965DC03657CD7344F64040
在数据库中的值。
我不能使用:
self.lonlat = "POINT(#{long},#{lat})"
self.save
问题
我需要在模型中设置一些特定的东西吗?