"A copy of ApplicationController has been removed from the module tree
but is still active!"
"can’t dup NilClass"
The old and deprecated fix for this was to add "unloadable" to the
proper model or controller. Sometimes this seems to need to be done
within the plugin.
http://robots.thoughtbot.com/post/159805560/tips-for-writing-your-own-rails-engine
http://groups.google.com/group/blacklight-development/browse_thread/thread/1f00bff8d8a26a83/b54d866e221e5030?hl=en&lnk=gst&q=unloadable#b54d866e221e5030
Here's a post about this issue that lists various work arounds instead
of the now deprecated "unloadable":
http://strd6.com/?p=250
Two possibilities are suggested:
1. Change the init.rb within the plugin to include the following:
load_paths.each do |path|
ActiveSupport::Dependencies.load_once_paths.delete(path)
end if config.environment == 'development'
2. Change environment.rb to include the following:
config.reload_plugins = true if RAILS_ENV == 'development'
Since our method of installation is changing, I decided to try each of
these methods by using the template. I used to template to get a full
demo application. I then overrode the index action in the catalog
controller. Unfortunately I was unable to reproduce the original
error. I went ahead and made each change in any case.
With #1 I got a new error. So there's no way I'm going to apply that.
With #2 I did not get a new error, but then again I wasn't able to
reproduce the original error either. But because this error seems to
creep in intermittently and unexpectedly, I think there is no big harm
in adding it. This would slow down requests in development mode since
the plugins are completely reloaded each time. But since I can't
currently reproduce the error, I don't know whether I ought to add it
or not.
Can anyone reproduce the "A copy of ApplicationController has been
removed from the module tree but is still active!" error?
Proposal: If someone else can't reproduce this error then we could
just add something to the documentation about possible fixes if this
error does creep in. This might belong in "Customizing Blacklight"
documentation since, from what I've read, it doesn't appear unless a
Controller or Model has been added/overridden.
Thoughts?
Jason
Yeah, I keep running into those sorts of things too, and also haven't
been able to fix them. If all else fails, you can always simply turn
off class reloading in development. put "config.cache_classes = false"
into your development.rb. That'll definitely fix the problem, at the
cost of eliminating class reloading in development, of course.
Class reloading sounds nice, but in my other Rails projects it
frequently fails too, I generally end up turning it off.
Ron DuPlain wrote:
> On Thu, Oct 29, 2009 at 11:01 AM, Jason Ronallo <jron...@gmail.com> wrote:
>
>> At the last committers meeting I was asked to report back about a kind
>> of error that creeps in intermittently in development mode when using
>> engines. You might have seen errors like the following:
>>
>> "A copy of ApplicationController has been removed from the module tree
>> but is still active!"
>> "can’t dup NilClass"
>>
>>
>
> I am consistently seeing:
>
> "A copy of ApplicationController has been removed from the module tree
> but is still active!"
>
> I did see "can’t dup NilClass" once while trying to triage the first