[Maypole] has_a display name
Alex McLintock
alex@owal.co.uk
Thu, 03 Jun 2004 17:56:54 +0100
When I have a "has_a" relationship between two tables, using an id
field, how does "Maypole" figure out what field to use as the "pretty"
name for that field?
Is it just any field with "name" in the name?
Here is my example in case you are interested...
I have a relationship "title has_a author"
SFBooksDB::Title->has_a(authornumber => "SFBooksDB::Author");
I can view and list titles of books, and the authornumber column comes
up with the authors "firstname" as a hyperlink instead of the integer
authornumber.
This is great - and a step in the right direction. It does something
similar in the edit screen where there is a huge drop down list of *all*
the author firstnames.
But an author's firstname doesn't uniquely identify an author, and I
can't see where I said it did. I would actually like it to be the
concatenation of "firstname", "secondname", and "surname".
I see that this hyperlink is built up in the template using
HTML::Element, but something needs to present the right data to that code.
I am not using the C:D:L:R stuff but have created the relationship
between title and author as follows.
SFBooksDB::Author->untaint_columns( printable => [qw/AuthorNumber
Surname Firstname Secondname / ],
integer => [qw/sf fantasy mystery/] );
SFBooksDB::Title->untaint_columns( printable => [qw/ TitleNumber Title /
] );
And I also added this in for luck
SFBooksDB::Author->columns(Primary => qw/AuthorNumber/);
SFBooksDB::Author->columns(Helpful => qw/Firstname Secondname Surname
Birth QuikSearch/);
( http://www.diversebooks.com/maypole/title/list/ )