# Handling Strange Superclass Mismatch

**URL:** <https://www.ruby-forum.com/t/handling-strange-superclass-mismatch/113151>\
**Category:** Ruby\
**Created:** [August 28, 2007, 5:21am UTC](https://www.ruby-forum.com/t/handling-strange-superclass-mismatch/113151 "2007-08-28T05:21:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [August 28, 2007, 5:21am UTC](https://www.ruby-forum.com/t/handling-strange-superclass-mismatch/113151/1 "2007-08-28T05:21:26Z")

</div>

I’m having a weird issue with Superclass Mismatches. I’m using  
ActiveRecord in a project. The strange thing is that i’m getting  
superclass mismatches the first time I even load a model. I’ve tried to  
handle it gracefully, here is my example. this doens’t work quite  
correclty. what can I do to get around this?

```
  files = Dir.glob(MY_SERVICES + models_path)
  if files.empty? then return nil end
  catch(:loadfiles) do
    puts "LOADING FILES"
    begin
      $:.unshift(MY_SERVICES)
      files.each_with_index do |file,i|
        rf = files.slice(i)
        require rf
      end
      $:.shift
    rescue TypeError => e
      puts e.message
      puts files.inspect
      if e.message =~ /superclass mismatch/
        throw :loadfiles
      end
    end
  end

```

Why would ActiveRecord have a fit like this? I don’t alter the class  
until a later point, I don’t see wy a superclass mismatch would be  
happening.

any ideas?

---

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [August 28, 2007, 6:17am UTC](https://www.ruby-forum.com/t/handling-strange-superclass-mismatch/113151/2 "2007-08-28T06:17:32Z")

</div>

I figured it out. was doing something retarded. thanks.
