Fix m2m regression from 8a67d9cf (simple but deadly)
Peter Rabbitson [Fri, 10 Jun 2016 06:22:38 +0000 (08:22 +0200)]
lib/DBIx/Class/Relationship/ManyToMany.pm
t/relationship/core.t

index fdfb5dd..c7cde16 100644 (file)
@@ -161,7 +161,7 @@ EOC
       ) if (
         @_ > 1
           or
-        ( @_ and ref $_[0] ne 'HASH' )
+        ( defined $_[0] and ref $_[0] ne 'HASH' )
       );
 
       my $guard;
index be8d7c9..de6afd7 100644 (file)
@@ -195,7 +195,8 @@ warnings_like {
   qr/\Qsearch( %condition ) is deprecated/
 ], 'Warning properly bubbled from search()';
 
-$cd->set_producers([$schema->resultset('Producer')->all]);
+# the undef-attr-arg at the end is deliberate: this is what FormFu does
+$cd->set_producers([$schema->resultset('Producer')->all], undef);
 is( $cd->producers->count(), $prod_before_count+2,
     'many_to_many set_$rel(\@objs) count ok' );
 $cd->set_producers([$schema->resultset('Producer')->find(1)]);