[Catalyst] update record with unique ID

Danny Warren danny at io.com
Mon Apr 9 21:32:09 GMT 2007

Michael Higgins wrote:
> Right. I want to update the record as defined by that primary key.
> I guess I found the answer: 
> ->update_or_create({
> Seems to do the trick, checking for unique and updating with other values
> posted. Too easy, as usual.  ;-)
> Cheers,

Ignore my response as well then... ;)

(Though it might be useful for others, I see people trying to do this 
*way* too often even though you weren't)

Yep, the update_or_create method is extremely useful and pretty slick. 
I usually have to write a stored procedure to make sure this gets done 
correctly, but once again DBIC does it the right way out of the box!


More information about the Catalyst mailing list