Hi All,
I’m pretty new to Engines, but in upgrading a Rails application to 2.0
I decided to move a bunch of modules from the deprecated “components”
directory to a new “vendor/modules” directory and Engines seemed like
the best drop-in replacement to do so.
Everything was great in production mode, but in development mode I kept
getting a bunch of strange errors of two different sorts:
-
Method missing errors from Models that were defined in the code
-
“A copy of XXX has been removed from the module tree but is still
active!” errors for Application Controllers
This is probably old hat to people who have been using engines for a
while, but I need to add the following to my init.rb to solve the
issues:
load_paths.each do |path|
Dependencies.load_once_paths.delete(path)
end
The reason for my issues is that I’m using the engine plugins in a way
that they refer back to models and controllers in the main application,
so they need to be reloaded in a similar method to the main application
controllers & models or the class constant references will become stale
on page refreshes.
Took me a couple hours of head banging on keyboard to figure this out so
maybe this info will help someone else.
-Pascal