[html-formfu] Model::DBIC inserts empty strings instead of NULL values

Alex Povolotsky tarkhil at over.ru
Mon Jun 6 09:04:14 GMT 2011


On 04/28/11 17:52, Dmitry Bigunyak wrote:
> Thanks for your reply, I'm not alone :)
> As a temporary solution I've blocked updating on new versions. Hope 
> Carl will reply in that subject.

I've patched model

__PACKAGE__->load_components(qw( FilterColumn ));
foreach my $bool ( qw(default_read default_write default_edit) ) {
     __PACKAGE__->filter_column($bool => {
         filter_to_storage => sub { ($_[1] eq '')?undef:$_[1] }
                                });
}


It's ugly as hell, but it works fine and replace empty string with undef.

Alex



More information about the HTML-FormFu mailing list