[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Can not find superclass

Gavin Kistner

9/20/2006 4:55:00 PM

> I defined two classes 'Super' und 'Sub' in two separate files
> that look
> like this:
>
> class Super < ActiveRecord::Base
> end
>
> class Sub < Super
> end
>
> After compiling 'Sub' I get the following error message
> "uninitialized
> constant Super (NameError)"

I believe your problem is that, for each request, rails only loads the
appropriate controller files. You need to put a 'require' or 'load' (or
some rails-specific require command) in your second file to ensure that
the controller file that you define Super in is being loaded (causing
Super to be defined) before you attempt to use it.