Re: Can we make might_have() relationships easier to use?

[prev] [thread] [next] [Date index for 2004/06/04]

From: Edward J. Sabol
Subject: Re: Can we make might_have() relationships easier to use?
Date: 15:33 on 04 Jun 2004
>> I'd still like to discuss adding an "add_*" method for might_have()
>> relationships, similar to has_many()'s "add_to_*" method. Any interest
>> there?
>
> I'm not seeing the benefits yet, as you can just add through setting,
> but feel free to convince me ...

Ah, but you can't *always* just add through setting, can you? Suppose another
not-null column is added to the Blurbs table like so:

     CREATE TABLE Blurbs (
        title                   VARCHAR(255) NOT NULL PRIMARY KEY,
        blurb                   VARCHAR(255) NOT NULL
        critic                  VARCHAR(255) NOT NULL
    )

Then "$cd->blurb('some value');" will fail because critic would be null on
the initial creation of the Blurbs record and the database doesn't allow
that. You need something like "$cd->add_blurb({ 'blurb' => 'some value',
'critic' => 'Joe Foobar' });" in order to properly create the entry.

(message missing)

Can we make might_have() relationships easier to use?
Edward J. Sabol 06:04 on 04 Jun 2004

Re: Can we make might_have() relationships easier to use?
Edward J. Sabol 15:33 on 04 Jun 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52