]> git.decadent.org.uk Git - maypole.git/commitdiff
Reorder the way we look for stringification column.
authorSimon Cozens <simon@simon-cozens.org>
Tue, 13 Apr 2004 13:16:37 +0000 (13:16 +0000)
committerSimon Cozens <simon@simon-cozens.org>
Tue, 13 Apr 2004 13:16:37 +0000 (13:16 +0000)
git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@129 48953598-375a-da11-a14b-00016c27c3ee

lib/Maypole/Model/CDBI.pm

index 495439e4e5df5ed5dd64db0a54150cdca6ea9631..4321ad8e978b940135cc72ef9424d55ed0e6bffa 100644 (file)
@@ -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];
 }