X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FModel%2FCDBI.pm;h=c7621d2c493491c33415dd7f021940395687e13d;hb=43c803ceb66d273f53b343229ed1ebd6eb0fc142;hp=b2e592973fa875c2b33ca60d23913335d647d636;hpb=f9f34047115475e7ca94d8c53273d1b3388cc33d;p=maypole.git diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index b2e5929..c7621d2 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -65,11 +65,14 @@ sub delete :Exported { sub adopt { my ($self, $child) = @_; $child->autoupdate(1); - $child->columns( Stringify => qw/ name / ); + if (grep { $_ eq "name" } $child->columns) { # Common case + $child->columns( Stringify => qw/ name / ); + } # Otherwise, work it out for yourself. } sub search :Exported { - return shift->SUPER::search(@_) if caller eq "Class::DBI"; # oops + return shift->SUPER::search(@_) if caller ne "Maypole::Model::Base"; + # A real CDBI search. my ($self, $r) = @_; my %fields = map {$_ => 1 } $self->columns; my $oper = "like"; # For now