Class loading problem after upgrading to 1.1

I just converted a 1.1 project to edge rails (1.2). In development with cache_classes set to false I keep getting these weird class loading errors. A page will load fine, but after going to another page and coming back I get NoMethodErrors saying a method on my model object doesn't exist, when it clearly does exist and worked fine on previous requests. In another case I get a message saying 'unexpected class Team, expecting: Team'. I did some minimal debugging and it seems like the same class name (Team) is getting a different object id. I was also stepping through reflections.rb and it looks like it's reloading classes that don't need to be reloaded (I hadn't changed anything) and the reloaded classes are incomplete, missing some methods. Or something. I'm confused at this point.

Setting cache_classes to true makes all the problems go away. I don't have these problems in 1.1. Curiously getting rid of a composed_of aggregation in one model class seems to help I think. At least I seem to get farther as the rhtml template blows up because it's expecting the composite to be there, the one I just removed (so it's a valid error). The composite object is a multi-part custom Name object, which is dead-simple. And I still have problems with other model objects that don't have any composed_of declarations. So that might be a red-herring.

I do have several custom classes that I require in my models and controllers. In some cases I have several little classes in one file that gets required in. I also have several model sub-classes for one inheritance hierarchy in one file.

I'm trying to create a smaller failing test case that I can post by creating a mini-app that has the problem. However I haven't managed to isolate the problem yet. Every time I extract out a smaller bit of the app the problem goes away. But I haven't tried that hard yet.

Any clues or ideas as to what to look for?

Thanks.

Steve

I just converted a 1.1 project to edge rails (1.2). In development with cache_classes set to false I keep getting these weird class loading errors.

The code that handles autoloading of classes has changed quite a bit in 1.2, and it doesn't behave in quite the same way as the old version. The basic assumption of the new implementation is that each file defines a single class and the pathname of the file matches the name of the class it defines.

I also have several model sub-classes for one inheritance hierarchy in one file.

That's likely to cause problems (it did for me). Split the model classes out one per file and see if that improves matters.

-Mark.