From 793c2a17f0a788114b9ccc888e6bea510f25342e Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Thu, 3 Jun 2010 09:08:11 -0400 Subject: [PATCH] Prevent exception in non-Rails environments. --- lib/geocoder.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/geocoder.rb b/lib/geocoder.rb index 52a1260b..95548ab0 100644 --- a/lib/geocoder.rb +++ b/lib/geocoder.rb @@ -332,7 +332,11 @@ module Geocoder # Name of the ActiveRecord scope method. # def self.scope_method_name - Rails.version.starts_with?("3") ? :scope : :named_scope + begin + Rails.version.starts_with?("3") ? :scope : :named_scope + rescue NameError + :named_scope + end end end -- GitLab