lib/geocoder/models/mongoid.rb in geocoder-1.1.4 vs lib/geocoder/models/mongoid.rb in geocoder-1.1.5
- old
+ new
@@ -16,10 +16,10 @@
def geocoder_init(options)
super(options)
if options[:skip_index] == false
# create 2d index
- if (::Mongoid::VERSION >= "3")
+ if defined?(::Mongoid::VERSION) && ::Mongoid::VERSION >= "3"
index({ geocoder_options[:coordinates].to_sym => '2d' },
{:min => -180, :max => 180})
else
index [[ geocoder_options[:coordinates], '2d' ]],
:min => -180, :max => 180