[Maypole] bug in macros.tt?
Marcus Ramberg
marcus@thefeed.no
Tue, 7 Dec 2004 18:22:17 +0100
On 7. des. 2004, at 18.04, Dave Howorth wrote:
> 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:
This makes sense, I've applied this patch. In the future, it would be
nice to have patches against the CPAN distribution (where the file is
named macros not macros.tt :) It's easier to apply then.
Marcus