From bec4a6ff4a3503a297ce1226f9bbd46341193616 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Tue, 13 Apr 2004 13:16:37 +0000 Subject: [PATCH] Reorder the way we look for stringification column. git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@129 48953598-375a-da11-a14b-00016c27c3ee --- lib/Maypole/Model/CDBI.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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]; } -- 2.39.5