Icon_search
Colin

Engines vs. Rails, Part the Second

Posted on 03/18/2008 by Colin
 | 

So we're upgrading to Rails 2.0 for our new sites, and I found a problem with the way Engines (even the latest version as of today) interacts with Rails 2.0.

First load of my Rails Engines page (in a development site):

[machine] Everything works great!

Second load:

[machine] A copy of ApplicationController has been removed from the module tree but is still active!

[me] Crap.

Enter some help from the interwebs: http://www.ruby-forum.com/topic/137733

[me] Hooray!

Basically, I just had to add this to the init.rb file in each Engines plugin:

load_paths.each do |path|
  Dependencies.load_once_paths.delete(path)
end

Tagged:  rails 2.0, module tree, ApplicationController has been removed, engines