[html-formfu] DBIC and has_many documentation clarification

Doug Orleans dougorleans at gmail.com
Tue May 17 00:18:11 GMT 2011


The documentation for implementing a DBIC form for a has_many relation
is wrong (or misleading):

http://search.cpan.org/~cfranks/HTML-FormFu-Model-DBIC-0.09000/lib/HTML/FormFu/Model/DBIC.pm#has_many_and_many_to_many_relationships

There, it says:

  The general principle is the same as for might_have and has_one
above, except you should use a Repeatable element instead of a Block,
and it needs to contain a Hidden field corresponding to the foreign
key.

But, as I found out after some debugging, the Hidden field actually
needs to correspond to the primary key (of the related table), not the
foreign key.  In the example given, the primary key and the foreign
key are the same (the "book" column), but this seems like a bad
example, since if the "book" column is a primary key in the review
table, that means there can only be one review row per book!

--Doug



More information about the HTML-FormFu mailing list