From: Michael Jemmeson Date: Thu, 8 Nov 2012 14:01:27 +0000 (+0000) Subject: doc fix for Resultset find_or_new and update_or_new methods X-Git-Tag: v0.08205~111 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=582fe49d7d17c4d61a1f3d4537ac7746272eec0e;p=dbsrgits%2FDBIx-Class.git doc fix for Resultset find_or_new and update_or_new methods --- diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index 9809504..8cf7971 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -405,6 +405,8 @@ michaelr: Michael Reddick milki: Jonathan Chu +mjemmeson: Michael Jemmeson + mstratman: Mark A. Stratman ned: Neil de Carteret diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 3112cb5..1c757d9 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -2614,7 +2614,6 @@ This can be applied recursively, and will work correctly for a structure with an arbitrary depth and width, as long as the relationships actually exists and the correct column data has been supplied. - Instead of hashrefs of plain related data (key/value pairs), you may also pass new or inserted objects. New objects (not inserted yet, see L), will be inserted into their appropriate tables. @@ -2738,7 +2737,7 @@ database! year => 2005, }); - if( $cd->in_storage ) { + if( !$cd->in_storage ) { # do some stuff $cd->insert; } @@ -2809,20 +2808,6 @@ L and L instead. Don't forget to call L to save the newly created row to the database! - my $cd = $schema->resultset('CD')->update_or_new( - { - artist => 'Massive Attack', - title => 'Mezzanine', - year => 1998, - }, - { key => 'cd_artist_title' } - ); - - if( $cd->in_storage ) { - # do some stuff - $cd->insert; - } - =cut sub update_or_create {