On Oct 1, 8:56 pm, Shawn Pyle <[EMAIL PROTECTED]>
wrote:
> Frederick Cheung wrote:
> > I bet if you switched to production mode it would work. What I think
> > is happening is:
>
> > - request calls Tracker.go
> > - Rails unloads loaded classes (since we're in dev mode)
> > - You threads continue to run trying to use classes that rails has
> > unloaded. Chaos ensues.
>
> > Fred
>
> Bingo! Putting my application in production mode allowed me to make
> continual requests. It, however, doesn't solve the problem though.
>
The depedencies system has been confused: something is referencing an
old copy of the module but that old copy should not be used anymore
(since rails has reloaded a fresh copy). This can be caused by using
require inappropriately (http://spacevatican.org/2008/9/28/required-or-
not) or when things that shouldn't be reloaded are reloaded (this can
be changed by adding files to Dependencies.load_once_paths (see also
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/710868b1292c737f/9e39c0716569a355?lnk=gst&q=module+tree#9e39c0716569a355).
In your case I'd guess the latter - you're extending something like a
plugin (which isn't reloaded between requests) with something that is
reloaded between requests = trouble.
Fred
> Problem:
> I've got a module (AccessControl) in RAILS_ROOT/lib that extends my
> controllers (which inherit from ResourceController) and adds
> functionality to AuthenticatedSystem. In development mode, this works
> fine via requests through the browser. However, once I try to consume
> the resources with ActiveResource, the first request succeeds and the
> next request fails with the following error:
>
> ArgumentError (A copy of AccessControl has been removed from the module
> tree but is still active!):
>
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/de
> pendencies.rb:250:in
> `load_missing_constant'
>
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/de
> pendencies.rb:468:in
> `const_missing'
> /lib/access_control.rb:122:in `controller_target'
> ...
>
> I can't figure out why this would work via the browser but not through
> ActiveResource. The only thing that's different, if I understand it
> correctly, are the headers:
> Accept: application/xml
> Content-Type: application/xml
>
> Why would that make a difference? Not only that, the error is
> originating in the class it says it can't find. Does anyone understand
> why this might be the case?
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---