From: Marc Mims Date: Sat, 8 Sep 2007 14:20:32 +0000 (-0700) Subject: discard_changes is also "refresh from storage" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aefa6508d3b034fb36d1a919c5be0aa363c52328;p=dbsrgits%2FDBIx-Class-Historic.git discard_changes is also "refresh from storage" --- diff --git a/lib/DBIx/Class/Manual/FAQ.pod b/lib/DBIx/Class/Manual/FAQ.pod index 0f3fa4a..d372115 100644 --- a/lib/DBIx/Class/Manual/FAQ.pod +++ b/lib/DBIx/Class/Manual/FAQ.pod @@ -285,6 +285,18 @@ Why slice instead of L or L. + + $row->discard_changes + +Discarding changes and refreshing from storage are two sides fo the same coin. When you +want to discard your local changes, just re-fetch the row from storage. When you want +to get a new, fresh copy of the row, just re-fetch the row from storage. +L does just that by re-fetching the row from storage +using the row's primary key. + =back =head2 Inserting and updating data diff --git a/lib/DBIx/Class/PK.pm b/lib/DBIx/Class/PK.pm index 9b9f8a4..2a68df5 100644 --- a/lib/DBIx/Class/PK.pm +++ b/lib/DBIx/Class/PK.pm @@ -30,6 +30,9 @@ sub _ident_values { Re-selects the row from the database, losing any changes that had been made. +This method can also be used to refresh from storage, retrieving any +changes made since the row was last read from storage. + =cut sub discard_changes {