]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/Model/CDBI/AsForm.pm
another change to object stringification in selects in AsForm
[maypole.git] / lib / Maypole / Model / CDBI / AsForm.pm
index b8e4e91a483191f424d6d6ac203f0bdb63351196..c072dc8d7112e1433e1fd5ef3c062b598947842e 100644 (file)
@@ -1173,11 +1173,13 @@ objects stringify method specified in $args->{stringify} as the content. Otherwi
 sub _options_from_objects {
   my ($self, $items, $args) = @_;
   my $selected = $args->{selected} || {};
-  my $stringify = $args->{stringify};
 
   my @res;
   for my $object (@$items) {
-    $stringify ||= $object->stringify_column if ($object->can('stringify_column'));
+    my $stringify = $args->{stringify};
+    if ($object->can('stringify_column') ) {
+      $stringify ||= $object->stringify_column if ($object->can($object->stringify_column));
+    }
     my $id = $object->id;
     my $opt = HTML::Element->new("option", value => $id);
     $id =~ s/^0*//;            # leading zeros no good in hash key