On 3/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> On Fri, 23 Mar 2007, John Siracusa wrote:
>> If you add the same bar twice, it'll add a new mapping each time.
>> That's what add_bars() does.
>
> Given that Rose knows that this is a many-to-many relationship between
> foos and bars, isn't
On Fri, 23 Mar 2007, John Siracusa wrote:
> If you add the same bar twice, it'll add a new mapping each time.
> That's what add_bars() does.
Given that Rose knows that this is a many-to-many relationship between
foos and bars, isn't it pretty far-fetched that you would actually
want duplicate rec
On 3/10/07, Mike Schilli <[EMAIL PROTECTED]> wrote:
> $foo->add_bars({ string => "I am Bar" });
> $foo->save();
>
> The first time this is run, records for both "I am Foo" in foos and "I am Bar"
> in bars are created [...] and the relationship table contains the mapping:
>
> mysql> sele
> CREATE TABLE foo_bar_map (
> id INTEGER AUTO_INCREMENT PRIMARY KEY NOT NULL,
> foo_id INTEGER,
> bar_id INTEGER,
> FOREIGN KEY(foo_id) REFERENCES foos(id),
> INDEX(foo_id),
> FOREIGN KEY(bar_id) REFERENCES bars(id),
> INDEX(bar_id)
> )Type=InnoDB;
One of the most useful Rose features to me is the
$foo->bar({ unique_column => $value });
notation which will create a new unique_column in the referenced table or
re-use one that's already there. It seems though that this doesn't work
correctly for many-to-many relationsships and I wonder wh