X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FModel%2FCDBI.pm;h=4321ad8e978b940135cc72ef9424d55ed0e6bffa;hb=bec4a6ff4a3503a297ce1226f9bbd46341193616;hp=495439e4e5df5ed5dd64db0a54150cdca6ea9631;hpb=52794a09f33740c16104826e7d4beb6610edebeb;p=maypole.git 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]; }