_pri_cols throws incorrect exceptions when called on an instances not attached to...
Peter Rabbitson [Wed, 14 Jul 2010 00:51:17 +0000 (02:51 +0200)]
Changes
lib/DBIx/Class/ResultSource.pm

diff --git a/Changes b/Changes
index 575416e..72615de 100644 (file)
--- a/Changes
+++ b/Changes
@@ -12,6 +12,8 @@ Revision history for DBIx::Class
           perlbrew and other local perl builds
         - bulk-inserts via $dbh->bind_array (void $rs->populate) now
           display properly in DBIC_TRACE
+        - Incomplete exception thrown on relationship auto-fk-inference
+          failures
 
     * Misc
         - Makefile.PL no longer imports GetOptions() to interoperate
index ef1559a..e2f6e13 100644 (file)
@@ -531,7 +531,8 @@ sub _pri_cols {
   my @pcols = $self->primary_columns
     or $self->throw_exception (sprintf(
       "Operation requires a primary key to be declared on '%s' via set_primary_key",
-      $self->source_name,
+      # source_name is set only after schema-registration
+      $self->source_name || $self->result_class || $self->name || 'Unknown source...?',
     ));
   return @pcols;
 }