add_relatinship now barfs without join condition
Matt S Trout [Mon, 1 Aug 2005 22:22:14 +0000 (22:22 +0000)]
lib/DBIx/Class/Relationship.pm
t/06relationship.t

index 1106f28..a13c0e3 100644 (file)
@@ -27,6 +27,7 @@ on searches.
 
 sub add_relationship {
   my ($class, $rel, $f_class, $cond, $attrs) = @_;
+  die "Can't create relationship without join condition" unless $cond;
   my %rels = %{ $class->_relationships };
   $rels{$rel} = { class => $f_class,
                   cond  => $cond,
index 7a28841..d0ed1c8 100644 (file)
@@ -39,4 +39,4 @@ like($@, qr/no such accessor/, 'failed when creating a rel with invalid key, ok'
 eval {
     $artist->add_relationship( tracks => 'DBICTest::Track' );
 };
-like($@, qr/no join condition/, 'failed when creating a rel without join condition, ok');
+like($@, qr/join condition/, 'failed when creating a rel without join condition, ok');