From 3da5fba56a4b01e9a4ac5aaf9b7c7c35ec2cc2f7 Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Tue, 29 Nov 2011 20:43:05 +0000 Subject: Fix ruby 1.8 compat. const_defined? only takes a second arg on 1.9. --- activerecord/lib/active_record/base.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record/base.rb') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 8cef066608..484fe5fb16 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -459,10 +459,11 @@ module ActiveRecord #:nodoc: end def generated_feature_methods - unless const_defined?(:GeneratedFeatureMethods, false) - include const_set(:GeneratedFeatureMethods, Module.new) + @generated_feature_methods ||= begin + mod = const_set(:GeneratedFeatureMethods, Module.new) + include mod + mod end - const_get(:GeneratedFeatureMethods) end # Executes a custom SQL query against your database and returns all the results. The results will -- cgit v1.2.3