I have a Rails application that is using multiple gems. Each gem provides assets, that are added to the Rails asset path:
- main app
- admin engine with customised forms
- wysiwyg engine
I want to override some of the partials provided by the wysiwyg engine inside the admin engine. I know that I need to affect the order that each engine adds its asset paths to the ActionView lookup context used by render for partial resolution, but I'm not sure how to do this.
This is actually documented by Rails but it took me a long time to find the relevant documentation. I assumed I needed to affect the bundler gem file load order, but I actually needed to define the order that engines (railties) are initialised:
https://api.rubyonrails.org/classes/Rails/Engine.html#class-Rails::Engine-label-Loading+priority
In my
config/application.rbI added:I would prefer to define the dependency between the admin engine and the wysiwyg engine, but this does address my issue.