Reloading bunch of files from rails engine in development

I have a rails engine. In initializer it requires a bunch of files
from some folder.
In this file user of my engine defines code, business logic,
configures engine, etc…
All this data is stored statically in my engine main module

module MyEngine

class << self
def application
@application ||= MyEngine::Application
end
end

end

I want this files to be reloaded on each request to application in
development mode.
(So that the user don’t have to reload server to see changes he just
made)
Of course I can do something like this instead of initializer

config.to_prepare do
MyEngine.application.clear!
load(‘some/file’)
end

But this way i will have issues (because constants defined in this
file wont really reloaded)

The ideal solution would be to make my whole engine reloadable on each
request, but a have not found the way to do it.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs