bugsy has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I have troubles with formfu checkboxgroup/DBIx. I build a very simple example of standard category = product mapping in Catalyst 5.90016. ( Same problem I got with earlier versions of all components )

The following example populates all the selected "categroies" ( e.g. content in the example ) but throws exception when trying to save.

Seems like DBIx doesn't pass the schemaname ( 'page_content_map' instead of 'web.page_content_map' ) or perhaps is it somehow connected with perlbrew ... ? I have build the model with 'qualify_objects=1 db_schema=SCHEMANAME' and the correct prefix is in all models and resultsets.

Thanks for any help in advance. Follows the declaration of the 3 tables + yml + DBI exception.

__PACKAGE__->table("web.page"); __PACKAGE__->has_many( "page_content_maps", "Web::Schema::Result::PageContentMap", { "foreign.page_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->many_to_many( 'content' => 'page_content_maps', 'content' ); __PACKAGE__->table("web.content"); __PACKAGE__->has_many( "page_content_maps", "Web::Schema::Result::PageContentMap", { "foreign.content_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); __PACKAGE__->many_to_many( 'page' => "page_content_maps", 'page' ); __PACKAGE__->table("web.page_content_map"); __PACKAGE__->belongs_to( "content", "Web::Schema::Result::Content", { id => "content_id" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" + }, ); __PACKAGE__->belongs_to( "page", "Web::Schema::Result::Page", { id => "page_id" }, { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" + }, ); yml
- type: Checkboxgroup name: content label: Content model_config: model: 'Web::Content'
Exception
DBI Exception: DBD::Pg::st execute failed: ERROR: relation "page_conte +nt_map" does not exist LINE 1: DELETE FROM "page_content_map" WHERE ( + "page_id" = $1 ) ^ [for Statement "DELETE FROM "page_content_map" WH +ERE ( "page_id" = ? )" with ParamValues: 1='2'] at /home/bugsy/perl5/ +perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.1/DBIx/Class/Schema.pm +line 1101.

Replies are listed 'Best First'.
Re: FormFu nested checkboxgroup
by greengaroo (Hermit) on Aug 20, 2012 at 13:20 UTC

    No sure if this can help, but in your code, sometime it reads "page_content_maps" and sometime "page_content_map" (without an S). Could this problem be only a typo, therefore relation "page_content_map" does not exist because its suppose to be "page_content_maps"?

    Take my advice. I don't use it anyway.