From 04ecca688e1f5e6f7a551e627392af165d30da76 Mon Sep 17 00:00:00 2001 From: Alessio Rocco Date: Wed, 22 Apr 2020 17:40:25 +0200 Subject: [PATCH] Add frontend/backend/api decorators to autoload path This is required in order to have the decorators correctly unloaded when we reload the application (calling reload! in console or on each request in development). --- lib/solidus_support/engine_extensions.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/solidus_support/engine_extensions.rb b/lib/solidus_support/engine_extensions.rb index 6bfa5c4..16249b7 100644 --- a/lib/solidus_support/engine_extensions.rb +++ b/lib/solidus_support/engine_extensions.rb @@ -59,10 +59,13 @@ def enable_solidus_engine_support(engine) paths['app/controllers'] << "lib/controllers/#{engine}" paths['app/views'] << "lib/views/#{engine}" + path = root.join("lib/decorators/#{engine}") + + config.autoload_paths += path.glob('*') + engine_context = self config.to_prepare do engine_context.instance_eval do - path = root.join("lib/decorators/#{engine}") load_solidus_decorators_from(path) end end