Hi! Thanks for visiting my blog. If you've received any value from my content would you mind supporting my new startup by downloading our browser add-on? It's called PriceBlink and makes online shopping a breeze. You can watch it in action here and download it for Chrome, Firefox, IE, or Safari by going to PriceBlink.com. Thank you and I hope you enjoy!

Rails Engines and the “A copy of ApplicationController has been removed from the module tree but is still active!” error

Apr 02

This was a beast of an error to get around, but finally I did in a not so clean manner. I’ve been working with Rails Engines and the approach was to make all controllers in my engine path “unloadable” per the last comment in this thread:

http://dev.rubyonrails.org/ticket/6001

Not the cleanest approach, but it will work until I can actually understand the core problem and refactor my code. This should at least buy you some time so that you can focus on creating modular Rails Engines!

4 comments

  1. I had the same problem. I solved it by adding the line:

    config.cache_classes = false

    in my config/environments/development.rb file. That had the unfortunate effect of requiring me to restart my development server whenever I wanted to add new changes. I think it’s a cleaner solution, but it definitely causes a lot of trouble when developing.

  2. Okay, but doesn’t that only fix your problem for development purposes? I’m assuming you don’t disable your class cache in a staging or production env. Would love to hear more about what you’re doing and I agree that approach is a hassle during development :) Thanks for sharing.

  3. config.cache_classes = false

    is in development.rb by default, I guess the Boris means:

    config.cache_classes = true

    which (seems) fix my issue when mixing authlogic and smerf

  4. Thanks Horace, fixed mine to mixing authlogic, facebook, and refinery… is annoying though and feels like a bodge.

Leave a Reply