From: Brandon L. Black Date: Tue, 24 Jan 2006 18:36:23 +0000 (+0000) Subject: merging 564:565 from resultset branch to trunk for lib/DBIx/Class/Relationship/Belong... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0cc038295414af942ccd5b3a6edde124d22b9431;p=dbsrgits%2FDBIx-Class-Historic.git merging 564:565 from resultset branch to trunk for lib/DBIx/Class/Relationship/BelongsTo.pm (filter accessor on single-col explicit hash cond) --- diff --git a/lib/DBIx/Class/Relationship/BelongsTo.pm b/lib/DBIx/Class/Relationship/BelongsTo.pm index b1ef52a..326a99a 100644 --- a/lib/DBIx/Class/Relationship/BelongsTo.pm +++ b/lib/DBIx/Class/Relationship/BelongsTo.pm @@ -45,9 +45,10 @@ sub belongs_to { } $cond_rel->{"foreign.$_"} = "self.".$cond->{$_}; } + my $acc_type = (scalar keys %$cond_rel == 1) ? 'filter' : 'single'; $class->add_relationship($rel, $f_class, $cond_rel, - { accessor => 'single', %{$attrs || {}} } + { accessor => $acc_type, %{$attrs || {}} } ); } else {