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:
Raul E Rangel 2014-09-02 10:03:19 -06:00
Родитель e35ec69f90
Коммит 9d3557db1f
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -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