empty update OK even if row is not in database
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Row.pm
index 06f850b..ecbff0c 100644 (file)
@@ -518,7 +518,6 @@ this method.
 
 sub update {
   my ($self, $upd) = @_;
-  $self->throw_exception( "Not in database" ) unless $self->in_storage;
 
   my $ident_cond = $self->{_orig_ident} || $self->ident_condition;
 
@@ -528,6 +527,9 @@ sub update {
   $self->set_inflated_columns($upd) if $upd;
   my %to_update = $self->get_dirty_columns;
   return $self unless keys %to_update;
+
+  $self->throw_exception( "Not in database" ) unless $self->in_storage;
+
   my $rows = $self->result_source->storage->update(
     $self->result_source, \%to_update, $ident_cond
   );