Skip Menu | will be shut down on March 1st, 2021.

This queue is for tickets about the HTML-FormFu-Model-DBIC CPAN distribution.

Report information
The Basics
Id: 53887
Status: new
Priority: 0/
Queue: HTML-FormFu-Model-DBIC

Owner: Nobody in particular
Requestors: mzrinsky [...]

Bug Information
Severity: Normal
Broken in: 0.06000
Fixed in: (no value)

Subject: creating related records.
Download (untitled) / with headers
text/plain 865b
We have a schema something like the following.. Company (id, address_id) Address (id, street, etc.) Company has a relationship, __PACKAGE__->belongs_to( 'address', 'Schema::Result::Address', { '' => 'self.address_id' }, ); We then have a form, which will create a company, and its address all in one shot, which has - type: Fieldset legend: "Company Address" nested_name: address This all works fine, the company record will be created, and the address record will be created, however the address record will NOT be associated with the company record. (i.e. address_id in company will not be set to the id of the newly created address record.) Attached is a patch that fixes the issue, but I can't take credit for it, as it was on the mailing list in Nov '08.
Subject: formfu_belongsto.diff
Index: lib/HTML/FormFu/Model/ =================================================================== --- lib/HTML/FormFu/Model/ (revision 1226) +++ lib/HTML/FormFu/Model/ (working copy) @@ -369,6 +369,7 @@ _save_columns( $base, $dbic, $form ) or return; $dbic->update_or_insert; + $dbic->discard_changes; _save_relationships( $self, $base, $dbic, $form, $rs, $attrs, \@rels ); @@ -449,6 +450,9 @@ nested_base => $rel, from => $dbic->result_class, } ); + + $dbic->set_from_related( $rel, $target ); + $dbic->update(); } } }

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to