lib/mongoid_location/location.rb in mongoid_location-0.3.3 vs lib/mongoid_location/location.rb in mongoid_location-0.3.5
- old
+ new
@@ -52,10 +52,12 @@
# @param [String,Symbol] name
# @param [Hash] options options for spatial_index
def spatial_index name, options = {}
self.spatial_fields_indexed << name
- if Mongoid::VERSION =~ /3.0/
+ # fix 3.x version
+ if Mongoid::VERSION =~ /^3.\d/
+ #if Mongoid::VERSION =~ /3.0/
index({name => '2d'}, options)
else
index [[name, '2d']], options
end
end