html-formhandler-model-dbic icon indicating copy to clipboard operation
html-formhandler-model-dbic copied to clipboard

fix: changing unique_constraints default

Open davewood opened this issue 12 years ago • 2 comments

hfh checks all unique constraints of the result source by default.

opting out of this doesnt work as described in the docs because the unique_constraints uses lazy_build and a separate build sub and not default.

... so you need to override '_build_unique_constraints' instead of setting a default for the 'unique_constraints' attribute.

davewood avatar Oct 29 '12 13:10 davewood

ping

davewood avatar Jan 22 '19 09:01 davewood

workaround

#package MyApp::Schema::Result::Foo;
__PACKAGE__->add_unique_constraint('my_unique_constraint_name' => [qw/ bar baz /]);

#package MyApp::Web::Form::Foo;
override '_build_unique_constraints' => sub { ['my_unique_constraint_name'] };

davewood avatar Feb 11 '19 11:02 davewood