[Rails] Re: Single table inheritance - HowTo?

Iván Vega Rivera ivanvega at gmail.com
Sat Jan 7 17:41:47 GMT 2006


Matthew, although a bit crankyly ;-), had the answer. I wasn't using the 
correct type name for each class.

Although you do make a point. I should've used your method to test how 
STI worked in the first place.

Thanks!

Ivan V.

Alain Ravet wrote:
> Iván
>
>
> The 'type' column is used by Rails in the background and, most of the 
> time, there is no need for you to manipulate it explicitly.
>
>
> So, if you have
>    class Foo < ActiveRecord
> and
>    class SuperFoo < Foo
>
> , you can query them directly:
>
>    allRecords = Foo.find(:all)
>    onlyTheSuperFoos = SuperFoo.find(:all)
>
> Did that answer your question?
>
> Alain
>
> _______________________________________________
> Rails mailing list
> Rails at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>




More information about the Rails mailing list