On 6/22/06, Ash Berlin <[EMAIL PROTECTED]> wrote:
Alex Beamish wrote:
>
>     So join => 'tracks' doesn't mean join to the `tracks' table, it means
>     join to the `tracks' relationship, which happens to exist on the
>     `track' table. Just like in the first example you gave `cd' didn't
>     refer to a table, it referred to a relationship that just so happened
>     to be named the same as the table.
>
>
> So does DBIx::Class drop the trailing 's' and look for the first
> relationship in the other table?
>
> The problem I'm having is that 'tracks' is in the Perl code, but
> 'tracks' doesn't appear anywhere in the database, just 'track'. From
> the database:
>
No.

When you say join on tracks, it uses the relationship "tracks", which in
the case of the tutorial is defined via

__PACKAGE__->has_many('tracks' => 'MyDatabase::Main::Track');

So, it then goes to MyDatabase::Main::Track and finds out what table that referes to, which in this case is "track"

Any clearer?

Yes. Yes. Yes.

Now I see where 'tracks' was coming from.

Thank you. Thank you. My brain can rest now.

--
Alex Beamish (talexb)
Toronto, Ontario

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to