aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md5
-rw-r--r--activerecord/lib/active_record/railtie.rb6
2 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index aa561bb8d3..e74ed62888 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,10 +1,13 @@
## unreleased ##
+* Require ActiveRecord::Base in railtie hooks for rake_tasks, console and runner to
+ avoid circular constant loading issues. [Backport #7695] [Fixes #7683 and #882] *Ben Holley*
+
* Maintain context for joins within ActiveRecord::Relation merges.
Backport #10164.
*Neeraj Singh + Andrew Horner*
-
+
* Make sure the `EXPLAIN` command is never triggered by a `select_db` call.
*Daniel Schierbeck*
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb
index 13b7c6e214..4e39654e5b 100644
--- a/activerecord/lib/active_record/railtie.rb
+++ b/activerecord/lib/active_record/railtie.rb
@@ -30,6 +30,7 @@ module ActiveRecord
)
rake_tasks do
+ require "active_record/base"
load "active_record/railties/databases.rake"
end
@@ -38,9 +39,14 @@ module ActiveRecord
# first time. Also, make it output to STDERR.
console do |app|
require "active_record/railties/console_sandbox" if app.sandbox?
+ require "active_record/base"
ActiveRecord::Base.logger = Logger.new(STDERR)
end
+ runner do |app|
+ require "active_record/base"
+ end
+
initializer "active_record.initialize_timezone" do
ActiveSupport.on_load(:active_record) do
self.time_zone_aware_attributes = true