[英]mongoid uninitialized constant Point
我听说并尝试实现那些库mongoid-geospatial
但是他们都提到了该类Point
,这对我来说是未定义的。 我想念什么?
我正在使用ActiveSupport :: Concern向我的模型添加地理关注
module Mappable
extend ActiveSupport::Concern
included do
include Mongoid::Geospatial
field :coordinates, type: Point, spatial: true
spatial_scope :coordinates
未初始化的常量Mappable :: Point(NameError)
您需要从适当的名称空间解析它。
field :coordinates, type: ::Mongoid::Geospatial::Point, spatial: true
这些文档中的示例有效,因为它们声明了一个不会创建新模块嵌套的类。 但是,在您的情况下,即使您包含Mongoid::Geospatial
Ruby也会尝试从当前模块( Mapping
)解析Point
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.