[html-formfu] Fix for creating a belongs_to related row
Carl Franks
fireartist at gmail.com
Mon Mar 1 18:56:36 GMT 2010
On 20 February 2010 17:10, Moritz Onken <onken at houseofdesign.de> wrote:
> Hi,
>
> this is a patch to allow a form to create a row in a belongs_to related table. This was not working till now. The Band.pm class had actually a wrong relationship set which made it look like it would work. I also added a test to confirm my findings.
Hi Moritz,
I've had a problem with an existing application, in which the $row
object created by $form->model->create()
is getting it's PK value stomped on, such that $row->id() returns undef.
I've narrowed it down to this line in this patch:
$dbic->$rel(undef) unless($dbic->$rel);
Before that's called, the PK has the expected auto-increment value,
after it's called, it's undef.
I can't find any documentation on what passing the `undef` value is
meant to do, and don't know what part of the DBIx::Class code gets run
at that point.
Of course, commenting it out causes your new test to fail.
Can you give me any pointers of what that DBIC code is doing?
Cheers,
Carl
More information about the HTML-FormFu
mailing list