X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FRelationship%2FHasMany.pm;h=6bdefd472eaf27b2521da14b754b84d73774340a;hb=67ba664605de95b5130b55397c7351f53dae4c19;hp=2c9a3bb723178eb60f7afc1ec92a08ec5cc24177;hpb=fd4df97578076cdb1a82385b21995ed28637e096;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Relationship/HasMany.pm b/lib/DBIx/Class/Relationship/HasMany.pm index 2c9a3bb..6bdefd4 100644 --- a/lib/DBIx/Class/Relationship/HasMany.pm +++ b/lib/DBIx/Class/Relationship/HasMany.pm @@ -16,6 +16,11 @@ sub has_many { "${class} has more" ) if $too_many; + $class->throw_exception( + "has_many needs a primary key to infer a join; ". + "${class} has none" + ) if !defined $pri && (!defined $cond || !length $cond); + my ($f_key,$guess); if (defined $cond && length $cond) { $f_key = $cond;