Sha256: 657eb86687b4492f420a2da8e4da49918dd54168086148ad12bca3b4e5f3fb28
Contents?: true
Size: 765 Bytes
Versions: 1
Compression:
Stored size: 765 Bytes
Contents
module Mongoid module Spacial module Document extend ActiveSupport::Concern included do attr_accessor :geo cattr_accessor :spacial_fields, :spacial_fields_indexed @@spacial_fields = [] @@spacial_fields_indexed = [] end module ClassMethods #:nodoc: # create spacial index for given field # @param [String,Symbol] name # @param [Hash] options options for spacial_index def spacial_index name, *options self.spacial_fields_indexed << name index [[ name, ::Mongo::GEO2D ]], *options end end def distance_from(key,p2, opts = {}) p1 = self.send(key) Mongoid::Spacial.distance(p1, p2, opts) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid_spacial-0.2.17 | lib/mongoid_spacial/spacial/document.rb |