X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSetColumn.pm;h=037b7714b15dd4c9d6cea3dca0179451708e310f;hb=acf7eb85d09f8491b7a73af6dd02d7fcf261c3fc;hp=3ed93426237ab04cbb26ca36c97c447f550575de;hpb=7ae9706c9d89bf85830a5598f30d48b8fb2a3199;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/ResultSetColumn.pm b/lib/DBIx/Class/ResultSetColumn.pm index 3ed9342..037b771 100644 --- a/lib/DBIx/Class/ResultSetColumn.pm +++ b/lib/DBIx/Class/ResultSetColumn.pm @@ -43,12 +43,11 @@ sub new { # prefetch causes additional columns to be fetched, but we can not just make a new # rs via the _resolved_attrs trick - we need to retain the separation between - # +select/+as and select/as - for my $attr (qw/prefetch collapse/) { - for (qw/attrs _attrs/) { - delete $new_parent_rs->{$_}{$attr} if ref $new_parent_rs->{$_}; - } - } + # +select/+as and select/as. At the same time we want to preserve any joins that the + # prefetch would otherwise generate. + my $init_attrs = $new_parent_rs->{attrs} ||= {}; + delete $init_attrs->{collapse}; + $init_attrs->{join} = $rs->_merge_attr( delete $init_attrs->{join}, delete $init_attrs->{prefetch} ); # If $column can be found in the 'as' list of the parent resultset, use the # corresponding element of its 'select' list (to keep any custom column