[Rails] Is STI the only way to do inheritance?
Rodrigo Alvarez Fernández
papipo at gmail.com
Tue Jan 17 10:47:47 GMT 2006
On 1/17/06, Jonathan Telfer <jtelfer at ntlworld.com> wrote:
>
> I'm currently coding a system which must store multiple contact methods
> for a user (phone, email, postal address etc). I'm planning a fairly
> straightforward inheritance hierachy for these, where each different method
> inherits from something like a ContactMethod class.
>
> The only mention of ActiveRecord support for inheritance I can find in the
> Wiki and the Agile Web Dev book is STI. What's not clear is whether STI is
> the *only* way that this will work. If I define my classes to have
> inheritance relationships and then create a separate table for each subclass
> will it not work?
>
>
Rails only support STI, but there are two more methods/patterns:
http://wiki.rubyonrails.com/rails/pages/SingleTableInheritance
You can read the Martin Fowler's explanations listed there.
Here http://dev.rubyonrails.org/ticket/600 you can find a patch for a Class
Table inheritance implementation. If yoy try it, please share your
experiencie with it here :].
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060117/5053a118/attachment.html
More information about the Rails
mailing list