aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/base.rb7
1 files changed, 4 insertions, 3 deletions
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