From: Peter Rabbitson Date: Wed, 14 Jul 2010 00:51:17 +0000 (+0200) Subject: _pri_cols throws incorrect exceptions when called on an instances not attached to... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7f505c17e411db792a53172d3b8681c59cf5a7b0;p=dbsrgits%2FDBIx-Class-Historic.git _pri_cols throws incorrect exceptions when called on an instances not attached to a schema (e.g. during belongs_to fk-column guessing) --- diff --git a/Changes b/Changes index 575416e..72615de 100644 --- 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 diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index ef1559a..e2f6e13 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -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; }