From 382ce292e888602c7fbf46327f24ccf58e5aa0b9 Mon Sep 17 00:00:00 2001 From: Graeme Porteous Date: Wed, 11 Oct 2023 16:17:50 +0100 Subject: [PATCH] Fix loading custom states in theme Let Zeitwerk ignore files which don't match the expected file structure. Fixes: https://github.com/mysociety/asktheeu-theme/issues/124 Credit to @laurentS for working out the issue in #7917 --- config/initializers/theme_loader.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/initializers/theme_loader.rb b/config/initializers/theme_loader.rb index ab694b522a..38a1a73a24 100644 --- a/config/initializers/theme_loader.rb +++ b/config/initializers/theme_loader.rb @@ -17,6 +17,9 @@ def require_theme(theme_name) require theme_main_include + # Let Zeitwerk ignore files which don't match the expected file structure + Rails.autoloaders.main.ignore(theme_lib.join('customstates.rb')) + Rails.configuration.paths['config/refusal_advice'].push( root.join('config/refusal_advice') )