fix for hm prefetch and test.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Row.pm
index 0837ba8..85a0551 100644 (file)
@@ -318,7 +318,7 @@ sub inflate_result {
                              $pre_source, @{$pre_rec}));
       }
       $new->related_resultset($pre)->set_cache(\@pre_objects);
-    } else {
+    } elsif (defined $pre_val->[0]) {
       my $fetched;
       unless ($pre_source->primary_columns == grep { exists $pre_val->[0]{$_} 
          and !defined $pre_val->[0]{$_} } $pre_source->primary_columns)
@@ -341,15 +341,16 @@ sub inflate_result {
   return $new;
 }
 
-=head2 insert_or_update
+=head2 update_or_insert
 
-  $obj->insert_or_update
+  $obj->update_or_insert
 
 Updates the object if it's already in the db, else inserts it.
 
 =cut
 
-sub insert_or_update {
+*insert_or_update = \&update_or_insert;
+sub update_or_insert {
   my $self = shift;
   return ($self->in_storage ? $self->update : $self->insert);
 }