Friday, February 20, 2009

many_to_many torture

I have just spent the best part of the last week wrestling with many_to_many configuration with DBIx in Catalyst.

My problem manifested it self as an error when calling $newApp->add_to_directory($directories);

DBIx seeming was unable to do the sensible thing and put the primary key from my apps table into the join table.

I also got errors like:
ManyToMany::__ANON__(): No such column

Now, after a week, I have discovered that if I update_or_insert my $newApp (which I made with $c->model('Proj::App')->new({}); first, then add_to_$rel works.

This wasn't obvious to me in the documentation, but hopefully you have stumgled across this post as you search for help with the same problem.

No comments: