[Rails] 'undefined method' using belongs_to and STI
Alex Young
alex at blackkettle.org
Fri Feb 3 13:00:21 GMT 2006
Jérôme L wrote:
> On 8/9/05, Holland <holland at bipedal.net> wrote:
>
>> NameError: uninitialized constant Race
>
> I get the same error with single table inheritance model with rails 1.0
> Isn't there any planned fix ?
In the dim depths of my memory (must be going back, ooh, weeks), I seem
to recall a similar problem that was fixed by making sure that the
interpreter had seen the STI subclasses before anything else happened,
because there's a set of conditions that result in them not getting
loaded automatically. I may be completely misremembering, but I *think*
putting a require 'stifile' for each STI subclass file at the end of
boot.rb does the trick.
Perhaps someone with a less sieve-like memory can pitch in and correct
me here?
--
Alex
More information about the Rails
mailing list