I have an engine with rails 3. The initializer requires a bunch of files from a folder. In this file, the user of my engine defines the code, business logic, configures the engine, etc. All this data is stored statically in the main module of my module (in the application attribute)
module MyEngine class << self def application @application ||= MyEngine::Application.new end end end
I want these files to be reloaded for each request in development mode. (So ββthe user does not need to restart the server to see the changes that he just made) Of course, I can do something like this instead of the initializer
config.to_prepare do MyEngine.application.clear! load('some/file') end
But this way I will have problems (because the constants defined in this file will not actually be reloaded).
The ideal solution is to get my entire engine to restart on every request, but have not found a way to do this.
source share