using find_or_create in add_to_
[prev]
[thread]
[next]
[Date index for 2005/02/03]
In my application, I almost always want to do find_or_create instead of
create. If there's already data in the database that matches the data I
have, I want to refer to it, not create a duplicate record.
So far, I've just been taking care to use find_or_create, and even
overriding create to give me a warning if I forget :)
Now I've come across a case where I want to use add_to_*, like
$obj->add_to_a_related_table({ some => values })
Now C-DBI-R-HasMany::_method_add_to calls create() so that's not what I
want. Has anybody got a neat way of dealing with this situation?
Thanks, Dave
|
using find_or_create in add_to_
Dave Howorth 15:28 on 03 Feb 2005
|