[html-formfu] many_to_many, again

Peter Shangov pshangov at yahoo.com
Mon Jun 20 07:57:01 GMT 2011


Hi Alex,

What is "Forum::Schema::Result::AG"? Do you mean "Forum::Schema::Result::AccGroup"? If so, the declaration of AccGroup.pm's has_many should be:

  __PACKAGE__->has_many(
    "a_gs",
    "Forum::Schema::Result::Account" ...


Cheers,

--
Peter


----- Original Message -----
> From: Alex Povolotsky <tarkhil at over.ru>
> To: "html-formfu at lists.scsys.co.uk" <html-formfu at lists.scsys.co.uk>
> Cc: 
> Sent: Sunday, 19 June 2011, 23:09
> Subject: [html-formfu] many_to_many, again
> 
> Hello!
> 
> After a three years break, I'm trying (again) to make many_to_many 
> relationship working. Again no success.
> 
> === Account.pm ===
> __PACKAGE__->has_many(
>   "a_gs",
>   "Forum::Schema::Result::AG",
>   { "foreign.aid" => "self.id" },
>   { cascade_copy => 0, cascade_delete => 0 },
> );
> __PACKAGE__->many_to_many('groups', 'a_gs', 'gid');
> ===
> 
> === AccGroup.pm ===
> __PACKAGE__->has_many(
>   "a_gs",
>   "Forum::Schema::Result::AG",
>   { "foreign.gid" => "self.id" },
>   { cascade_copy => 0, cascade_delete => 0 },
> );
> 
> __PACKAGE__->many_to_many('accounts', 'a_gs', 'aid');
> ===
> 
> === userlist.yml ===
> ---
> model_config:
>    resultset: AccGroup
> 
> indicator: submit
> 
> elements:
>   - type: Checkbox
>     name: accounts
>     label: Accounts
>     model_config:
>       resultset: Account
>       label_column: login
> 
>   - type: Submit
>     name: submit
> 
> ===
> 
> The code reads ALL accounts, and does not check any checkbox. I just don't 
> have guts to run debugger once again.
> 
> Maybe someone points me to my mistake?
> 
> Alex.
> 
> 
> _______________________________________________
> HTML-FormFu mailing list
> HTML-FormFu at lists.scsys.co.uk
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu
>



More information about the HTML-FormFu mailing list