From 26aab6d098be98520ad19fc34ce069dca6a08baf Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Wed, 18 Dec 2024 18:23:28 +0100 Subject: [PATCH] Use app.reloader to load patches `config.to_prepare` blocks run in arbitrary order. The reloader runs when we want it to run, after the code has been (re)loaded. --- lib/flickwerk/railtie.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/flickwerk/railtie.rb b/lib/flickwerk/railtie.rb index 9a3a7ea..ae38290 100644 --- a/lib/flickwerk/railtie.rb +++ b/lib/flickwerk/railtie.rb @@ -11,7 +11,7 @@ class Flickwerk::Railtie < Rails::Railtie end initializer "flickwerk.find_patches" do |app| - app.config.to_prepare do + app.reloader.to_prepare do Flickwerk.patch_paths.each do |path| Flickwerk::PatchFinder.new(path).call end @@ -19,7 +19,7 @@ class Flickwerk::Railtie < Rails::Railtie end initializer "flickwerk.add_patches", after: "flickwerk.find_patches" do |app| - app.config.to_prepare do + app.reloader.to_prepare do Flickwerk::PatchLoader.call end end