Defer loading action_controller
Use the lazy-load hooks to include ::SecureHeaders. This will prevent action_controller/action_view from getting loaded unless it's required.
This commit is contained in:
Родитель
e35ec69f90
Коммит
9d3557db1f
|
@ -3,7 +3,11 @@ if defined?(Rails::Railtie)
|
|||
module SecureHeaders
|
||||
class Railtie < Rails::Engine
|
||||
isolate_namespace ::SecureHeaders if defined? isolate_namespace # rails 3.0
|
||||
ActionController::Base.send :include, ::SecureHeaders
|
||||
initializer "secure_headers.action_controller" do
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
include ::SecureHeaders
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -34,4 +38,4 @@ else
|
|||
if defined? ActionController::Routing
|
||||
ActionController::Routing::RouteSet::Mapper.send :include, ::SecureHeaders::Routing::MapperExtensions
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче