Skip to content

Commit

Permalink
Add frontend/backend/api decorators to autoload path
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
AlessioRocco authored and kennyadsl committed Apr 22, 2020
1 parent 3b22d74 commit 04ecca6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/solidus_support/engine_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 04ecca6

Please sign in to comment.