diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/railtie.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 7b6d792931..5e4ce34934 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -23,6 +23,10 @@ module ActiveRecord ActiveRecord::Base.default_timezone = :utc end + initializer "active_record.logger" do + ActiveRecord::Base.logger ||= ::Rails.logger + end + initializer "active_record.set_configs" do |app| app.config.active_record.each do |k,v| ActiveRecord::Base.send "#{k}=", v @@ -45,9 +49,9 @@ module ActiveRecord # Setup database middleware after initializers have run initializer "active_record.initialize_database_middleware" do |app| middleware = app.config.middleware - if middleware.include?(ActiveRecord::SessionStore) - middleware.insert_before ActiveRecord::SessionStore, ActiveRecord::ConnectionAdapters::ConnectionManagement - middleware.insert_before ActiveRecord::SessionStore, ActiveRecord::QueryCache + if middleware.include?("ActiveRecord::SessionStore") + middleware.insert_before "ActiveRecord::SessionStore", ActiveRecord::ConnectionAdapters::ConnectionManagement + middleware.insert_before "ActiveRecord::SessionStore", ActiveRecord::QueryCache else middleware.use ActiveRecord::ConnectionAdapters::ConnectionManagement middleware.use ActiveRecord::QueryCache @@ -71,11 +75,6 @@ module ActiveRecord end end - # TODO: ActiveRecord::Base.logger should delegate to its own config.logger - initializer "active_record.logger" do - ActiveRecord::Base.logger ||= ::Rails.logger - end - initializer "active_record.i18n_deprecation" do require 'active_support/i18n' |