On 22 May 2011 11:35, Wolfgang <[email protected]> wrote:
> STI is a good approach, but my "subtables" have additional attributes
> and afaik this isn't supportet by STI, is it?

Yes, you just put the whole set of all attributes in the table.  It
wastes a small amount of space in the db but generally that is not an
issue.

Colin

>
> For example:
>
> user << Base
>  id
>  firstname
>  lastname
>  address
> end
>
> employee << user
>  <all of the above and additionally:>
>  salary
> end
>
> On 22 Mai, 10:41, Colin Law <[email protected]> wrote:
>> On 22 May 2011 09:37, Wolfgang <[email protected]> wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> > Hello Guys,
>>
>> > does anybody know wheter RoR is able to implement a generalisation of
>> > a database? I didn't find any solution for that on the internet.
>>
>> > Example
>>
>> > Person : Customer
>>
>> > or
>>
>> > Person : Employee
>>
>> > in the database such a generalisation is characterized by having the
>> > same PK in Customer and Person or Employee and Person!
>>
>> Would Single Table Inheritance (STI) dowhat you want?
>>
>> Colin
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to