Something is screwed up with the way Rails is loading my controllers.
I get the following error for one of my controllers:
ArgumentError in My content pagesController#edit
A copy of Goldberg::ContentPagesController has been removed from the
module tree but is still active!
F:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/
active_support/dependencies.rb:237:in load_missing_constant' F:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/ active_support/dependencies.rb:468:in
const_missing’
If I restart my server, I can perform a single action on the
controller, and then I get this error again on the following action.
I’ve done some searching, and found that others have had the same
problem:
Earlier in the week I had this problem with a bunch of my other
controllers, and I fixed it by following the advice at these threads.
I added the following line to my environment.rb:
config.load_once_paths += %W{ #{RAILS_ROOT}/app/controllers }
That fixed it for all the other controllers, but not for this one.
One difference with this controller is that I’ve subclassed it. I’m
using the Goldberg plugin, and I wanted to add some functionality to
the way content pages work. I wanted to touch the plugin code as
little as possible to facilitate future upgrades, so I created
MyContentPagesController, subclassed from
Goldberg::ContentPagesController, and modified the routings to make
sure my subclass gets used. I tried to fix the problem by adding the
path for Goldberg::ContentPagesController to load_once_paths, but that
didn’t make any difference.
Anyone got any ideas for how to fix this? In case it matters, I’m
using Rails 1.2.3.
Thanks,
Myron