Forum: Ruby on Rails Has_one and Class Table Inheritance

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.
6b3fdae055113ac88d9dcf3f4fd44455?d=identicon&s=25 Nuno (Guest)
on 2006-03-31 15:13
Hello, is there something wrong with using has_one to implement Class
Table Inheritance ?

Eg.

class Person < ActiveRecord::Base
   # attributes : eg. name, string
end

class Contact < Person
   # attributes :
   has_one :Person
   belongs_to :Company
end

Of course for a such simple case I could use Single Table Inheritance
but this is only an example and I don't like too much the fact of mixing
in a single table a bunch of inrelated and unused properties.

Your advice is welcome, thanks
This topic is locked and can not be replied to.