This module is supposed to be used in extensions engines to remove boilerplate code from gem engines.
As is right now, it loads all the decorators correctly for both development and production environment, since we were having some issues with Zeitwerk not loading decorators in production.
Instructions
To use it just extend the Engine with the provided module as follow:
module SolidusExtensionName
class Engine < Rails::Engine
engine_name 'solidus_extension_name'
inlcude SolidusSupport::EngineExtensions::Decorators
# ...
end
end
To make it work, be sure to remove the previous implementation from the
Engine, that should be something like:
def self.activate
Dir.glob(File.join(root, "app/**/*_decorator*.rb")) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
end
config.to_prepare(&method(:activate).to_proc)
I've also added a bit of documentation through code comments to explain why each block is needed since they are a bit cryptic and this could help gain some time when we'll have to touch the module again.
This module is supposed to be used in extensions engines to remove boilerplate code from gem engines.
As is right now, it loads all the decorators correctly for both development and production environment, since we were having some issues with Zeitwerk not loading decorators in production.
Instructions
To use it just extend the Engine with the provided module as follow:
To make it work, be sure to remove the previous implementation from the Engine, that should be something like: