Usually I add the following to config / application.rb to add autload_paths:
config.autoload_paths += Dir[Rails.root.join('app', 'poros', '{**}')]
How can I achieve the same in the engine? This seems to work when I just use the same code in application.rb in the host application, but I find it ugly that the code is not in the engine and it needs to be added to the host application for everything to work.
The only solution I found to add the download path through the engine is to add it to lib / engine / engine.rb:
config.to_prepare do
Dir.glob(Rails.root + "../../app/poros/**/*.rb").each do |c|
require_dependency(c)
end
end
However, there is something fundamentally wrong with this, as this leads to problems when I restart the console (for example, it tells me that the constants are already defined or that the power block cannot execute the problem twice)
? ( , /, googled, )