Sha256: 7a3d744a3956a5c1041752632cdf5707b5406f0827f2c6325b41bba5ff080a2f

Contents?: true

Size: 358 Bytes

Versions: 3

Compression:

Stored size: 358 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

    self.spatial_fields << field.name.to_sym
    self.spatial_fields_indexed << field.name.to_sym

    # Create 2Dsphere index
    sphere_index field.name

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid_geospatial-3.1.0 lib/mongoid_geospatial/helpers/sphere.rb
mongoid_geospatial-3.0.0 lib/mongoid_geospatial/helpers/sphere.rb
mongoid_geospatial-2.8.3 lib/mongoid_geospatial/helpers/sphere.rb