From: Robert Buels Date: Thu, 18 Feb 2010 19:26:50 +0000 (-0800) Subject: strip _id in naming of relationships in the case of multiple rels between two tables X-Git-Tag: 0.05003~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=012fd1057e6dd3662fd6a0f668bbed86f0f302e4;p=dbsrgits%2FDBIx-Class-Schema-Loader.git strip _id in naming of relationships in the case of multiple rels between two tables --- diff --git a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm index 57c5392..4f8625f 100644 --- a/lib/DBIx/Class/Schema/Loader/RelBuilder.pm +++ b/lib/DBIx/Class/Schema/Loader/RelBuilder.pm @@ -247,9 +247,9 @@ sub generate_code { # col names to distinguish if($counters{$remote_moniker} > 1) { my $colnames = q{_} . join(q{_}, @$local_cols); - $local_relname = $self->_inflect_plural( - lc($local_table) . $colnames - ); + $local_relname = lc($local_table) . $colnames; + $local_relname =~ s/_id$//; #< strip off any trailing _id + $local_relname = $self->_inflect_plural( $local_relname ); $remote_relname .= $colnames if keys %cond > 1; } else { $local_relname = $self->_inflect_plural(lc $local_table);