>>...and everything Just Worked, except for one small detail: the
>>"authors" list on the ...library/titles/view/#### page just has the
>>authors' names, and not the relationships.
>>
>
>
> Isn't this what you want since you looking at the title already?
If a book is *written by* Smith and *edited by* Jones, the
title_author_rel table will record "by" and "ed.", respectively, in the
relationship field.
When I do my funky dance with JeevesLibrary::TitleAuthorRel::process, a
titles/view page will show me
GREAT AMERICAN NOVEL
...
Authors
* by Smith
* ed. Jones
whereas if I just set up all the relationships in their default
fashions, I get
GREAT AMERICAN NOVEL
...
Authors
* Smith
* Jones
>>(a) why I can't add :Exported methods, dammit
Aha! It has to do with the order of module loading. (All of my model
classes are in the JeevesLibrary.pm file, which may be a contributing
factor.) If I wrap the call to JeevesLibrary->setup in a BEGIN block,
then I can add the exported methods.
Now I can implement a search method.....
>>(b) if there is a more elegant way to do the same thing
>>
>
>
> Do the object switcheroo in the view Template instead, maybe or just modify the
> template.
Hmm. My gut feeling is that this kind of mangling should stay in the
model, but I'm not sure I can really justify that as more than a
pedantic desire to see how much I can do without touching the default
templates.
I suspect that the OO-philosophically-ideal way to handle this would be
to create a new subclass of Class::DBI::Relationship -- perhaps calling
it Class::DBI::Relationship::HasAWithQualifier -- and use that to
describe the relationship between title_author_rel and authors.
> Isn't authors an array possibly? I can't see how view template handles that as
> it seems to print the column. Does TT2 automatically print all elements of
> array?
One-to-many relationships in the "view" page are handled by the
view_related macro, which the view template calls.
-- // seth gordon // sethg at ropine.com // http://dynamic.ropine.com/yo/ //_______________________________________________ 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