Forum: Ruby on Rails Class Table Inheritance implementation

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
48cdd934c82cdad2f288d0c5bf4f51c5?d=identicon&s=25 Jr Santos (jsantos)
on 2006-06-05 19:42
I know that Rails uses the Single-Table Inheritance as mentioned in the
wiki (http://wiki.rubyonrails.com/rails/pages/SingleTabl...). I
was wondering if there was an easy way of implementing Class Table
Inheritance easily (one table per class) as defined in
http://www.martinfowler.com/eaaCatalog/classTableI....

The model that I am used to is Class Table Inheritance, and for some
uses it just feels more elegant to use that rather than Singe Table
Inheritance.
6ef8cb7cd7cd58077f0b57e4fa49a969?d=identicon&s=25 Brian Hogan (Guest)
on 2006-06-05 20:58
(Received via mailing list)
What's a good way to backup and restore a database and the images on
the file system? Does anyone have any code to share? I have my own
idea that I can write up but I don't want to reinvent anything.
Dc730e56d34292b3a5c73925cf5a9d39?d=identicon&s=25 ajaya agrawalla (ajay)
on 2006-06-06 05:30
JR Santos wrote:
> I know that Rails uses the Single-Table Inheritance as mentioned in the
> wiki (http://wiki.rubyonrails.com/rails/pages/SingleTabl...). I
> was wondering if there was an easy way of implementing Class Table
> Inheritance easily (one table per class) as defined in
> http://www.martinfowler.com/eaaCatalog/classTableI....
>
> The model that I am used to is Class Table Inheritance, and for some
> uses it just feels more elegant to use that rather than Singe Table
> Inheritance.

I find SingleTable inheritance better as it has less maintainance.
Having independent  tables for object where only the behavior is
different doesn't make sense as databases are supposed to capture the
persistent data and let your class define the behavior.  It's just too
many tables to to hold each type of object.

ajay
This topic is locked and can not be replied to.