Came across this little head-scratcher today: added a new migration to our application and, when trying to run it, Rake aborted the migration with an error of "superclass mismatch". After poking around trying to find out if we accidentally introduced a second copy of ActiveRecord::Base somewhere, I discovered the actual answer.
Imagine if you will that our application has a model class called Foo. This means we have a class:
class Foo < ActiveRecord::Base
Somewhere along the line, somebody wanted to update the schema for Foo and ran this command:
script/generate migration Foo
Which gives us, buried in the db/migration folder:
class Foo < ActiveRecord::Migration # etc. end
Thus, the type mismatch problem as Ruby discovers two completely different classes called Foo with mismatching superclasses. This isn't the odd part. The odd part, which I haven't figured out yet, is why we only saw the problem now. You see, we just added migration #044. The offending migration was #007.
When I figure out why it worked until now, I'll report back. Until then, if you ever get a superclass mismatch error in a rake run, look at your migrations.