From: Peter Rabbitson Date: Fri, 10 Jun 2016 06:22:38 +0000 (+0200) Subject: Fix m2m regression from 8a67d9cf (simple but deadly) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2d9a96fd40eb4be24a9a254953e1e3cd8e20ea3a;p=dbsrgits%2FDBIx-Class.git Fix m2m regression from 8a67d9cf (simple but deadly) --- diff --git a/lib/DBIx/Class/Relationship/ManyToMany.pm b/lib/DBIx/Class/Relationship/ManyToMany.pm index fdfb5dd..c7cde16 100644 --- a/lib/DBIx/Class/Relationship/ManyToMany.pm +++ b/lib/DBIx/Class/Relationship/ManyToMany.pm @@ -161,7 +161,7 @@ EOC ) if ( @_ > 1 or - ( @_ and ref $_[0] ne 'HASH' ) + ( defined $_[0] and ref $_[0] ne 'HASH' ) ); my $guard; diff --git a/t/relationship/core.t b/t/relationship/core.t index be8d7c9..de6afd7 100644 --- a/t/relationship/core.t +++ b/t/relationship/core.t @@ -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)]);