rails/actionpack/lib/abstract_controller.rb
Jonathan Hefner b287779499 Add {Abstract,Action}Controller.deprecator
This commit adds `AbstractController.deprecator` and
`ActionController.deprecator`, and replaces all usages of
`ActiveSupport::Deprecation.warn` in `actionpack/lib/action_controller`
with the latter.

Additionally, this commit adds `ActionController.deprecator` to
`Rails.application.deprecators`.  Because `AbstractController` does not
have its own railtie to do the same, `AbstractController` and
`ActionController` use the same deprecator instance.  Thus, both can be
configured via `Rails.application.deprecators[:action_controller]` or
via config settings such as `config.active_support.report_deprecations`.
2022-10-27 16:20:53 -05:00

35 lines
800 B
Ruby

# frozen_string_literal: true
require "action_pack"
require "active_support"
require "active_support/rails"
require "active_support/i18n"
require "abstract_controller/deprecator"
module AbstractController
extend ActiveSupport::Autoload
autoload :ActionNotFound, "abstract_controller/base"
autoload :Base
autoload :Caching
autoload :Callbacks
autoload :Collector
autoload :DoubleRenderError, "abstract_controller/rendering"
autoload :Helpers
autoload :Logger
autoload :Rendering
autoload :Translation
autoload :AssetPaths
autoload :UrlFor
def self.eager_load!
super
AbstractController::Caching.eager_load!
AbstractController::Base.descendants.each do |controller|
unless controller.abstract?
controller.eager_load!
end
end
end
end