From ab5070ede10c4ad9332f342232ab4d12db2bc5b0 Mon Sep 17 00:00:00 2001
From: monmon <shimon@skimatalk.com>
Date: Wed, 3 Aug 2016 19:15:56 +0900
Subject: Check if the logger exists before trying to use it

---
 activerecord/lib/active_record/scoping/named.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'activerecord/lib')

diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb
index 5395bd6076..e69c4ab657 100644
--- a/activerecord/lib/active_record/scoping/named.rb
+++ b/activerecord/lib/active_record/scoping/named.rb
@@ -174,7 +174,7 @@ module ActiveRecord
       protected
 
         def valid_scope_name?(name)
-          if respond_to?(name, true)
+          if respond_to?(name, true) && logger
             logger.warn "Creating scope :#{name}. " \
                         "Overwriting existing method #{self.name}.#{name}."
           end
-- 
cgit v1.2.3