Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AquaGeek/971791 to your computer and use it in GitHub Desktop.
Save AquaGeek/971791 to your computer and use it in GitHub Desktop.
Rails Lighthouse ticket #6493
From b817947827a60e2756e45ea17d7d8212f09d58ae Mon Sep 17 00:00:00 2001
From: Ludo van den Boom <ludo@cubicphuse.nl>
Date: Tue, 1 Mar 2011 16:18:31 +0100
Subject: [PATCH] Add rake_tasks hook to force ActiveRecord::Base to be loaded when executing rake task avoiding reference loops.
---
activerecord/lib/active_record/railtie.rb | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb
index cace6f0..a4c1b78 100644
--- a/activerecord/lib/active_record/railtie.rb
+++ b/activerecord/lib/active_record/railtie.rb
@@ -24,6 +24,10 @@ module ActiveRecord
rake_tasks do
load "active_record/railties/databases.rake"
+
+ # When loading rake tasks, force ActiveRecord to be loaded to avoid cross
+ # references when loading a constant for the first time.
+ ActiveRecord::Base
end
# When loading console, force ActiveRecord to be loaded to avoid cross
--
1.7.4.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment