The Rails dependency mechanism tracks which constants are defined when anything is loaded automatically. In the development environment, these constants are undefined after each request, so that possibly changed versions can be reloaded for the next request. Usually, that''s nice and everything, but my current case it leads to problems. I''m dynamically defining cache sweeper classes from within a "macro" in my controllers. These cache sweeper classes are bound to constants and as such are unloaded after the request. However, cache sweepers are also registered as observers on the relevant models and these registrations are retained across requests. Here''s where the trouble starts: observers are instantiated before the controller for the current request is loaded. As a result, on the second request, the Rails dispatcher tries to instantiate observers, the sweepers, that have been undefined at the end of the previous request, but not yet been re-defined on the current request. Summing up, I need a clean way of telling the dependency mechanism not to unload my sweepers. From looking at the relevant code, I can probably wedge it in there with brute force, but that''s not what I''d like to do. Maybe I''ve just overlooked some elegant way to achieve what I want. Michael -- Michael Schuerig mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org http://www.schuerig.de/michael/ --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---