Good point about object equality -- #is_a? comparisons wouldn't work as expected, either.
Note that this is an existing problem; it's not specific to Tom Lea's patch. But it does demonstrate that objects kept around between requests will never work exactly as you'd expect them to. I suppose the only fix for this would be, remove all instance methods from AR instances, including methods defined in superclasses, in AR::Base.reset_subclasses, and implement a method_missing with an informative error, as you suggest. On Nov 9, 3:16 am, Aliaksey Kandratsenka <[EMAIL PROTECTED]> wrote: > У Суб, 08/11/2008 у 13:24 -0800, Geoff B піша:> As I understand it, if we do > allow AR instances to persist between > > requests, there'd only be an issue when you modify the class of an > > instance that was cached -- in this case, you'd need to restart the > > server. But I think that makes intuitive sense -- cached instances > > would then be out-of-sync with the current class definition. > > If you always restart than there's no difference in keeping old versions > or turning them to zombies. > > Anyway, if we allow multiple class versions we should warn people. Many > things will stop working, like for example equality testing of active > record instances. Otherwise people will spend many hours trying to track > down extremely weird and hard to find bugs, many of them, probably, > unsuccessfully. > > Ideal solution would be to upgrade old classes and instances to new > definition in a manner similar to CLOS. But I don't see a clean way to > do that in ruby. The only candidate approach I see is via > ObjectSpace#each_object (rewrite references to old instances & classes > to point to upgraded instances), but it cannot inspect and rewrite > closures, so will not work too. And of course ObjectSpace#each_object > should be considered implementation-specific feature, because it cannot > be efficiently implemented on all ruby implementations. > > -- > Aliaksey Kandratsenka <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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-core?hl=en -~----------~----~----~----~------~----~------~--~---
