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

**URL:** <https://www.ruby-forum.com/t/a-copy-of-applicationcontroller-has-been-removed-from-the-module-tree-but-is-still-active/173511>\
**Category:** Rails\
**Created:** [August 10, 2009, 8:32pm UTC](https://www.ruby-forum.com/t/a-copy-of-applicationcontroller-has-been-removed-from-the-module-tree-but-is-still-active/173511 "2009-08-10T20:32:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [August 10, 2009, 8:32pm UTC](https://www.ruby-forum.com/t/a-copy-of-applicationcontroller-has-been-removed-from-the-module-tree-but-is-still-active/173511/1 "2009-08-10T20:32:46Z")

</div>

Yes, more dependencies.rb fun!

As far as I’m able to ascertain, these errors started appearing after  
upgrading from Rails 2.3.1 to 2.3.2 and persist in 2.3.3.

They’re highly nonderministic and appear rather sporadically, which  
makes it extremely frustrating. Multiple developers on our team have  
experienced this problem across varying versions of Ruby/Rails.

They’re happening in two of our applications. These applications do  
not have any of the same plugins except AuthLogic. We are not using  
Rails Engines.

The two apps to share a number of gems which are initially loaded  
using my require\_all gem (using config.gem in initialize.rb). I’m  
thinking this might be a potential source of the problems.

I have read about a number of people encountering this problem, and  
the general consensus about a workaround is to set the offending class  
as “unloadable”. Will setting “unloadable” in ApplicationController  
propagate to the other controllers which subclass  
ApplicationController?

How do we trace down the actual cause of this problem and fix it?

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [August 11, 2009, 3:29pm UTC](https://www.ruby-forum.com/t/a-copy-of-applicationcontroller-has-been-removed-from-the-module-tree-but-is-still-active/173511/2 "2009-08-11T15:29:33Z")

</div>

I’ve not encountered this particular bug, but I wonder if it could be  
related to this from Lighthouse:

[https://rails.lighthouseapp.com/projects/8994/tickets/1524](https://rails.lighthouseapp.com/projects/8994/tickets/1524)

How exactly are you loading the shared gems?

–Matt J.

---

<div class="post-metadata">

**Author:** ![murfhy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d26b3c/32.png) [@murfhy](https://www.ruby-forum.com/u/murfhy)\
**Post date:** [August 11, 2009, 9:14pm UTC](https://www.ruby-forum.com/t/a-copy-of-applicationcontroller-has-been-removed-from-the-module-tree-but-is-still-active/173511/3 "2009-08-11T21:14:25Z")

</div>

On Aug 11, 7:28 am, Matt J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’ve not encountered this particular bug, but I wonder if it could be  
> related to this from Lighthouse:
> 
> [#1524 Gem plugins, autoloading, and dev mode reloading - Ruby on Rails - rails](https://rails.lighthouseapp.com/projects/8994/tickets/1524)

We’re loading our gems using config.gem, so I doubt that’s the issue.

> How exactly are you loading the shared gems?

They all subclass a base class which implements autoloading using  
require\_all. This happens once when the Rails app is started, via  
config.gem in environment.rb
