From: Brandon L. Black Date: Tue, 24 Jan 2006 18:30:54 +0000 (+0000) Subject: use filter accessor on single-column explicit join condition hashes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b107d3593eeda31ac2123fca4ecbfba9462f5c2f;p=dbsrgits%2FDBIx-Class-Historic.git use filter accessor on single-column explicit join condition hashes --- 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 {