From a2813ba68836bfae09b8479c53a7d7b7b6460e9e Mon Sep 17 00:00:00 2001
From: Christian Gambardella <mail@gambardella.info>
Date: Wed, 17 Oct 2012 13:21:17 +0300
Subject: [PATCH] Update lib/geocoder/models/mongoid.rb

Doesnt crash if ::Mongoid::VERSION isn't defined.
It does fall back to Mongoid version < 3
---
 lib/geocoder/models/mongoid.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/geocoder/models/mongoid.rb b/lib/geocoder/models/mongoid.rb
index 9e0b9fd8..763c2983 100644
--- a/lib/geocoder/models/mongoid.rb
+++ b/lib/geocoder/models/mongoid.rb
@@ -18,7 +18,7 @@ module Geocoder
         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
-- 
GitLab