Use join_type => 'LEFT' rather than 'LEFT OUTER' for consistency with
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / RelBuilder.pm
index 0a29af1..4e917a6 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 use Carp::Clan qw/^DBIx::Class/;
 use Lingua::EN::Inflect::Number ();
 
-our $VERSION = '0.04999_02';
+our $VERSION = '0.04999_06';
 
 =head1 NAME
 
@@ -170,10 +170,11 @@ sub generate_code {
         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);
@@ -217,7 +218,7 @@ sub generate_code {
               args => [ $remote_relname,
                         $remote_class,
                         \%cond,
-                        $nullable ? { join_type => 'LEFT OUTER' } : ()
+                        $nullable ? { join_type => 'LEFT' } : ()
               ],
             }
         );