Sha256: c82a6ea3960181d4696ee7c7ceefa3fa86b060eecd94f5a814c7823671df0b4c

Contents?: true

Size: 347 Bytes

Versions: 4

Compression:

Stored size: 347 Bytes

Contents

#
# Mongoid fields extension
#
# field :foo, :sphere => true
#
Mongoid::Fields.option :sphere do |model, field, _options|
  # options = {} unless options.kind_of?(Hash)

  model.class_eval do
    spatial_fields << field.name.to_sym
    spatial_fields_indexed << field.name.to_sym

    # Create 2Dsphere index
    sphere_index field.name
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-geospatial-5.1.0 lib/mongoid/geospatial/helpers/sphere.rb
mongoid-geospatial-5.0.0 lib/mongoid/geospatial/helpers/sphere.rb
mongoid-geospatial-4.0.1 lib/mongoid/geospatial/helpers/sphere.rb
mongoid-geospatial-4.0.0 lib/mongoid/geospatial/helpers/sphere.rb