From: Simon Cozens Date: Tue, 13 Apr 2004 13:16:37 +0000 (+0000) Subject: Reorder the way we look for stringification column. X-Git-Tag: 2.10~233 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=bec4a6ff4a3503a297ce1226f9bbd46341193616;p=maypole.git Reorder the way we look for stringification column. git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@129 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index 495439e..4321ad8 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -26,6 +26,7 @@ modules. sub related { my ($self, $r) = @_; + # Has-many methods; XXX this is a hack map {to_PL($_)} grep { exists $r->{config}{ok_tables}{$_} } @@ -66,8 +67,8 @@ sub delete :Exported { sub stringify_column { my $class = shift; return ($class->columns("Stringify"), - (grep { $_ ne "id" } $class->primary_columns), - (grep { $_ eq "name" } $class->columns) + (grep { /(name|title)/i } $class->columns), + (grep { !/id$/i } $class->primary_columns), )[0]; }