Re: one to one relationship revisited (has_own)

[prev] [thread] [next] [Date index for 2005/01/21]

From: Perrin Harkins
Subject: Re: one to one relationship revisited (has_own)
Date: 21:59 on 21 Jan 2005
On Thu, 2005-01-20 at 14:26 -0800, Peter Speltz wrote:
> i think it would be cool if programs could distinguish if has_a relationships
> were one to one or many to one. AsForm treats them as many to one by making a
> select box of all existing foreign objects. 

I don't see the difference, from the side of the table that is embedding
another table's ID.  It can never put the ID of more than one other
object in that column.

True one-to-one relationships are not common, since they could always be
put into the same table.  The current method people usually use for them
is might_have, where this row's ID is stored in the other table's
column.

>  Then AsForm could instead of making a select box of all phones, make input
> box(s) for column(s) in phone. 

Sounds more and more like a might_have.  Or maybe just a custom
presentation that a generic tool like AsForm shouldn't be asked to
create.

> Furthermore, i thought that create and update may be able to automatically
> create and update phone:
> 
> $prsn = Person->create( {...., phone_id => {...} } );

That could be added to might_have.  I think that would be useful.

> Delete however would cascade like has_many.

It already does with might_have.

- Perrin

(message missing)

one to one relationship revisited (has_own)
Peter Speltz 22:26 on 20 Jan 2005

Re: one to one relationship revisited (has_own)
Perrin Harkins 21:59 on 21 Jan 2005

Re: one to one relationship revisited (has_own)
Peter Speltz 05:11 on 22 Jan 2005

Re: one to one revisited (has_own)
Peter Speltz 18:16 on 22 Jan 2005

Re: one to one revisited (has_own)
William McKee 15:39 on 24 Jan 2005

Re: one to one revisited (has_own)
Peter Speltz 16:01 on 24 Jan 2005

Re: one to one revisited (has_own)
Andreas Fromm 08:19 on 25 Jan 2005

Re: one to one revisited (has_own)
Peter Speltz 19:34 on 25 Jan 2005

Selecting from a datetime field in MySQL
John Day 22:24 on 25 Jan 2005

Re: Selecting from a datetime field in MySQL
Perrin Harkins 22:29 on 25 Jan 2005

Re: one to one revisited (has_own)
Peter Speltz 23:24 on 26 Jan 2005

Re: one to one revisited (has_own)
Peter Speltz 17:40 on 01 Feb 2005

Re: one to one revisited (has_own)
Peter Speltz 08:23 on 25 Jan 2005

Generated at 12:39 on 05 Feb 2005 by mariachi v0.52