my $remote_relname;
# for single-column case, set the remote relname to the column
- # name, to make filter accessors work
+ # name, to make filter accessors work, but strip trailing _id
if(scalar keys %cond == 1) {
- my ($col) = keys %cond;
- $remote_relname = $self->_inflect_singular($cond{$col});
+ my ($col) = values %cond;
+ $col =~ s/_id$//;
+ $remote_relname = $self->_inflect_singular($col);
}
else {
$remote_relname = $self->_inflect_singular(lc $remote_table);