# Superclass mismatch for ActiveRecord::Base subclass

**URL:** <https://www.ruby-forum.com/t/superclass-mismatch-for-activerecord-base-subclass/128485>\
**Category:** Rails\
**Created:** [February 8, 2008, 12:49am UTC](https://www.ruby-forum.com/t/superclass-mismatch-for-activerecord-base-subclass/128485 "2008-02-08T00:49:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_H](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9de053/32.png) [@Ben\_H](https://www.ruby-forum.com/u/Ben_H)\
**Post date:** [February 8, 2008, 12:49am UTC](https://www.ruby-forum.com/t/superclass-mismatch-for-activerecord-base-subclass/128485/1 "2008-02-08T00:49:26Z")

</div>

I am trying to figure out a superclass mismatch TypeError exception in  
one of my rails projects. Maybe someone can help here. This occurs  
when I am attempting to load a file. On the first load, everything is  
fine, but on subsequent loads, it gives me this exception. Here is  
the pertinent code.

in check.rb  
class Check \< ActiveRecord::Base  
end

in drc.rb  
class DRC \< Check  
def after\_initialize  
self.name = “DRC”  
self.description = “Design Rule Check”  
self.global = false  
end  
end

Then in a controller I load this file in on a specific action.

```
  load file
  c = check_name.constantize.new
  c.save

```

The first time I load there are no issues. It creates a new Check  
object for me and saves it into the db. Now when I delete the check  
from the db and try to run through this code again I get:

superclass mismatch for class DRC

I’m not changing the superclass for DRC. I’m not reading in a  
different file. I’m not sure what is going on here. Any thoughts?
