aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record.rb6
-rwxr-xr-xactiverecord/lib/active_record/base.rb2
-rw-r--r--activerecord/lib/active_record/railtie.rb16
3 files changed, 12 insertions, 12 deletions
diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb
index 5942640c85..8a1aa50e24 100644
--- a/activerecord/lib/active_record.rb
+++ b/activerecord/lib/active_record.rb
@@ -111,10 +111,10 @@ module ActiveRecord
autoload :TestCase
autoload :TestFixtures, 'active_record/fixtures'
+end
- base_hook do
- Arel::Table.engine = Arel::Sql::Engine.new(self)
- end
+ActiveSupport.on_load(:active_record) do
+ Arel::Table.engine = Arel::Sql::Engine.new(self)
end
I18n.load_path << File.dirname(__FILE__) + '/active_record/locale/en.yml' \ No newline at end of file
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 80f8569644..75576f146a 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -2245,4 +2245,4 @@ end
# TODO: Remove this and make it work with LAZY flag
require 'active_record/connection_adapters/abstract_adapter'
-ActiveRecord.run_base_hooks(ActiveRecord::Base)
+ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base)
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb
index de47461c73..04c4a9c153 100644
--- a/activerecord/lib/active_record/railtie.rb
+++ b/activerecord/lib/active_record/railtie.rb
@@ -23,18 +23,18 @@ module ActiveRecord
log_subscriber :active_record, ActiveRecord::Railties::LogSubscriber.new
initializer "active_record.initialize_timezone" do
- ActiveRecord.base_hook do
+ ActiveSupport.on_load(:active_record) do
self.time_zone_aware_attributes = true
self.default_timezone = :utc
end
end
initializer "active_record.logger" do
- ActiveRecord.base_hook { self.logger ||= ::Rails.logger }
+ ActiveSupport.on_load(:active_record) { self.logger ||= ::Rails.logger }
end
initializer "active_record.set_configs" do |app|
- ActiveRecord.base_hook do
+ ActiveSupport.on_load(:active_record) do
app.config.active_record.each do |k,v|
send "#{k}=", v
end
@@ -44,7 +44,7 @@ module ActiveRecord
# This sets the database configuration from Configuration#database_configuration
# and then establishes the connection.
initializer "active_record.initialize_database" do |app|
- ActiveRecord.base_hook do
+ ActiveSupport.on_load(:active_record) do
self.configurations = app.config.database_configuration
establish_connection
end
@@ -53,7 +53,7 @@ module ActiveRecord
# Expose database runtime to controller for logging.
initializer "active_record.log_runtime" do |app|
require "active_record/railties/controller_runtime"
- ActionController.base_hook do
+ ActiveSupport.on_load(:action_controller) do
include ActiveRecord::Railties::ControllerRuntime
end
end
@@ -71,9 +71,9 @@ module ActiveRecord
end
initializer "active_record.load_observers" do
- ActiveRecord.base_hook { instantiate_observers }
+ ActiveSupport.on_load(:active_record) { instantiate_observers }
- ActiveRecord.base_hook do
+ ActiveSupport.on_load(:active_record) do
ActionDispatch::Callbacks.to_prepare(:activerecord_instantiate_observers) do
ActiveRecord::Base.instantiate_observers
end
@@ -81,7 +81,7 @@ module ActiveRecord
end
initializer "active_record.set_dispatch_hooks", :before => :set_clear_dependencies_hook do |app|
- ActiveRecord.base_hook do
+ ActiveSupport.on_load(:active_record) do
unless app.config.cache_classes
ActionDispatch::Callbacks.after do
ActiveRecord::Base.reset_subclasses