Hello,
I’ve been working on a solution for making rails reload engine
controllers and models. Initially, after a fair amount of googling, I
came up with the following, in development.rb:
config.after_initialize {
Dependencies.load_once_paths = Dependencies.load_once_paths.select {
|path| (path =~ /app/).nil? }
}
While this solves the problem, I figured it would be even better to do
it within the engines, which lead to this dirty hack:
in engines/lib/engines/plugin.rb, I added the following at the end of
the load method:
if ::RAILS_ENV == 'development'
Dependencies.load_once_paths =
Dependencies.load_once_paths.select { |path| (path =~
/#{name}/app/).nil? }
end
A possibly cleaner approach would be to monkeypatch the
add_plugin_load_paths method in rail’s plugin loader, but it would
just be more code for the same effect.
Any thoughts?
mateo