Skip to content

Commit

Permalink
Use lazy load hooks to safely integrate with ActionController (#14)
Browse files Browse the repository at this point in the history
This uses the ActiveSupport Lazy Load hooks callback to integrate ZipKit
once ActionController is loaded. Previously, the Railtie would force
ActionController to load which can cause problems.
  • Loading branch information
excid3 authored Aug 11, 2024
1 parent c920f6b commit 938f58b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/zip_kit/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class ZipKit::Railtie < ::Rails::Railtie
initializer "zip_kit.install_extensions" do |app|
ActionController::Base.include(ZipKit::RailsStreaming)
ActiveSupport.on_load(:action_controller) do
include(ZipKit::RailsStreaming)
end
end
end

0 comments on commit 938f58b

Please sign in to comment.