From: Peter Rabbitson Date: Fri, 19 Feb 2010 10:14:30 +0000 (+0000) Subject: Fix for RT54697 X-Git-Tag: v0.08120~26 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=efc8ae6e0e781a9c04c1d519ff8a2daa9ace5e49;p=dbsrgits%2FDBIx-Class.git Fix for RT54697 --- diff --git a/Changes b/Changes index f1994c5..6be2659 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,7 @@ Revision history for DBIx::Class schemas get called on $schema->deploy - Fix count() with group_by aliased-function resultsets - Massive refactor and cleanup of primary key handling + - Fixed regression losing custom result_class (really this time) 0.08119 2010-02-15 09:36:00 (UTC) - Add $rs->is_ordered to test for existing order_by on a resultset diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 036cb38..7937ded 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -535,7 +535,7 @@ sub find { } # Run the query - my $rs = $self->search ($query, {result_class => $self->result_class, %$attrs}); + my $rs = $self->search ($query, $attrs); if (keys %{$rs->_resolved_attrs->{collapse}}) { my $row = $rs->next; carp "Query returned more than one row" if $rs->next; @@ -1136,6 +1136,7 @@ sub result_class { if ($result_class) { $self->ensure_class_loaded($result_class); $self->_result_class($result_class); + $self->{attrs}{result_class} = $result_class if ref $self; } $self->_result_class; } diff --git a/t/inflate/hri.t b/t/inflate/hri.t index fab040e..eb74da1 100644 --- a/t/inflate/hri.t +++ b/t/inflate/hri.t @@ -26,6 +26,9 @@ my $schema = DBICTest->init_schema(); my $cd1 = $rs->find ({cdid => 1}); is_deeply ( $cd1, $datahashref1, 'first/find return the same thing'); + + my $cd2 = $rs->search({ cdid => 1 })->single; + is_deeply ( $cd2, $datahashref1, 'first/search+single return the same thing'); } sub check_cols_of {