Subject: | Manual/Tutorial/03_MoreCatalystBasics Inaccurate Code Quotes And Relationships |
Date: | Fri, 12 Nov 2010 06:02:41 -0700 |
To: | bug-Catalyst-Manual [...] rt.cpan.org |
From: | Mark Hughes <mhughes [...] law.du.edu> |
In
Catalyst-Manual-5.8004/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics section
"Updating the Generated DBIx::Class Result Class Files" there are
several problems.
1) the first quoted section inaccurately shows POD.
2) the belongs_to code shown in the third quote from the bottom of the
section shows POD which isn't actually generated.
3) the belongs_to code quoted is incorrect. It is:
__PACKAGE__->belongs_to(
"book",
"MyApp::Schema::Result::Book",
{ id => "book_id" },
{ join_type => "LEFT" },
);
It should be:
__PACKAGE__->belongs_to("book_id", "MyApp::Schema::Result::Book", { id
=> "book_id" });
4) I believe that because the belongs_to code is incorrect in the
tutorial, the two many_to_many relations at the end of this section are
wrong. For example, the first is:
__PACKAGE__->many_to_many(authors => 'book_authors', 'author');
I believe it should be:
__PACKAGE__->many_to_many(authors => 'book_authors', 'author_id');
This is similar to bug 57989, concerning a later section of the tutorial.
5) it would be helpful if the section of BookAuthor.pm quoted and
discussed right before the first many_to_many relationship were the
author (actually, author_id) belongs_to rather than the book (actually,
book_id) belongs_to. It would make figuring out how to derive the
many_to_many relationship easier to see.