I think there's a bug in the maybe_link_view macro.
It produces HTML links from fields that are foreign keys to rows in
related tables, but is a bit overzealous. It divides fields into two
categories, 'objects' and 'non-objects' and it assumes that every object
can only be a foreign key. But this isn't true, it could just be a field
with an inflated value (such as Time::Piece).
Its means of determining whether something is an object is to invoke the
thing's 'table' method. This doesn't do the right thing on arbitrary
objects :) I suggest instead testing whether the thing inherits from
Maypole::Model::Base and this appears to work for me. Here's a patch:
--- factory/macros.tt Mon Oct 25 12:21:55 2004
+++ custom/macros.tt Tue Dec 7 16:50:49 2004
@@ -34,14 +33,13 @@
[%
MACRO maybe_link_view(object) BLOCK;
- IF object.table; # It's an object, i.e. a has-a
+ IF object.isa('Maypole::Model::Base') ;
link(object.table, "view", object.id, object);
ELSE;
object;
Cheers, Dave
_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole
This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT