From: Christopher H. Laco Date: Sun, 20 Aug 2006 04:16:30 +0000 (+0000) Subject: remove_columns now deletes columns from _columns fixing has_columns false positives X-Git-Tag: v0.07002~31 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class.git;a=commitdiff_plain;h=a918d9014c5fc4684efb8b6c2abb84cf60d9c826 remove_columns now deletes columns from _columns fixing has_columns false positives --- diff --git a/Changes b/Changes index 85e169b..beee9bd 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for DBIx::Class + - remove_columns now deletes columns from _columns + 0.07001 2006-08-18 19:55:00 - add directory argument to deploy() - support default aliases in many_to_many accessors. diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 659948f..ffb8bae 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -247,7 +247,7 @@ sub remove_columns { } foreach (@cols) { - undef $columns->{$_}; + delete $columns->{$_}; }; $self->_ordered_columns(\@remaining); diff --git a/t/60core.t b/t/60core.t index aae959e..c5959d0 100644 --- a/t/60core.t +++ b/t/60core.t @@ -7,7 +7,7 @@ use DBICTest; my $schema = DBICTest->init_schema(); -plan tests => 62; +plan tests => 63; # figure out if we've got a version of sqlite that is older than 3.2.6, in # which case COUNT(DISTINCT()) doesn't work @@ -289,5 +289,6 @@ ok(!$@, "stringify to false value doesn't cause error"); is_deeply([$schema->source('CD')->columns], [qw/cdid artist title year/]); $schema->source('CD')->remove_columns('year'); is_deeply([$schema->source('CD')->columns], [qw/cdid artist title/]); + ok(! exists $schema->source('CD')->_columns->{'year'}, 'year still exists in _columns'); }