Skip to content

Commit

Permalink
Make sure _proxy_slots is not undef.
Browse files Browse the repository at this point in the history
  • Loading branch information
moltar authored and Arthur Axel 'fREW' Schmidt committed Sep 17, 2014
1 parent e480f17 commit 28a47a1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Revision history for {{$dist->name}}

{{$NEXT}}
- Fix ::Helper::ResultSet::DateMethods1 for Oracle (thanks Alexander Hartmaier!)
- Fix yet another issue with ->copy and proxied ResultSet methods (thanks again
moltar!)

2.023006 2014-09-03 17:44:34-05:00 America/Chicago
- Fix a few ::DateMethods1 methods when using a bound date (vs a column)
Expand Down
2 changes: 1 addition & 1 deletion lib/DBIx/Class/Helper/Row/ProxyResultSetMethod.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ sub proxy_resultset_method {
}

sub copy {
delete local @{$_[0]->{_column_data}}{@{$_[0]->_proxy_slots}};
delete local @{$_[0]->{_column_data}}{@{$_[0]->_proxy_slots||[]}};

shift->next::method(@_);
}
Expand Down
3 changes: 2 additions & 1 deletion t/lib/TestSchema/Result/Bloaty.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package TestSchema::Result::Bloaty;

use DBIx::Class::Candy -components => [
'Helper::Row::ProxyResultSetUpdate'
'Helper::Row::ProxyResultSetUpdate',
'Helper::Row::ProxyResultSetMethod',
];

table 'Bloaty';
Expand Down
6 changes: 6 additions & 0 deletions t/row/proxy-resultset-method.t
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,11 @@ subtest 'copy result' => sub {
is $g3->id, 100, 'id is correctly overridden';
};

subtest 'copy result without any proxy defined' => sub {
my $bloaty = $schema->resultset('Bloaty')->first;
ok my $bcopy = $bloaty->copy({ id => 100, name => 'boo' }), 'Copied result';
is $bcopy->id, 100, 'id is correctly overridden';
};

done_testing;

0 comments on commit 28a47a1

Please sign in to comment.