[Dbix-class] Example confusion -- my own

Alex Beamish talexb at gmail.com
Fri Jun 23 03:15:29 CEST 2006


On 6/22/06, Ash Berlin <ash at cpan.org> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/dbix-class/attachments/20060622/fed18937/attachment.htm 


More information about the Dbix-class mailing list