I am using a Rails Engine as a Gem in my Rails Application. Now I have inherited a class from the rails engine in a model of my rails app.
1. Rails App Model Code
class AppModelOne < EngineGem::EngineClassOne
# body of the class
end
But while running the command rake zeitwerk:check
in terminal, I got a error that
uninitialised constant <class:32323332xx> EngineModuleTwo
Now I checked the rails engine code of EngineClassOne in which there is a include statement of EngineModuleTwo.
2. Rails Engine Class Code
module EngineGem
class EngineClassOne
include EngineModuleTwo::EngineSubModuleOne
end
end
The Engine file-structure:
EngineGem -> |-> app -> models |-> engine_gem -> engine_class_one
| |-> engine_module_two -> engine_sub_module_one
|-> gemspec
Why it is not able to load the module, Can anyone explain how to load the module inside the rails engine while using it in my rails app?