Re: setting up relationships

[prev] [thread] [next] [Date index for 2004/06/21]

From: steve shapero
Subject: Re: setting up relationships
Date: 23:34 on 21 Jun 2004
yuval--

1. re: this problem
2. for the other suffering souls out there who need a hand-holding
tutorial (aka hackers like me who are only intermediate perl programmers
and may not have mastered some of the other skills needed to use this
very cool package)

1.
thanks so much for your help.  i did some experimenting, and managed to
get close to what i want, but not quite.  

Supposing I am defining TrackArtist.  If i do this:

__PACKAGE__->has_a (artist => 'Artist' );

then i get this error:
has_a needs a valid column at HasA.pm line 12

But if i do this:

__PACKAGE__->has_a (artist_id => 'Artist' );

it more or less works in that it compiles.  but when i do

my $artists = $track->artist;

then artists is just a collection of track_ids and artist_ids for the
given track.  useful, but not nearly as cool as just getting the artist
names themselves.  why does it barf on artist and insist on getting a
column name (i.e. artist_id)?

in Artist i have (when it works):

__PACKAGE__->has_many (tracks => [ TrackArtist => track_id ])

i tried this when using (artist => 'Artist') as above...

__PACKAGE__->has_many (tracks => [ TrackArtist => track ])

i've read the documentation and studied the examples many times.  

2. when i nail this thing, i am going to write a really clearly laid-out
HOWTO so that other people like me won't waste the time of you geniuses
who write this stuff with our simple-minded questions.  

i think the most helpful thing for intermediate hackers is to have a
complete sample.  the stuff in the t directory of the distro looks like
it uses some deprecated functions, etc.

thanks
steve


(message missing)

setting up relationships
steve shapero 19:30 on 21 Jun 2004

Re: setting up relationships
Yuval Kogman 20:40 on 21 Jun 2004

Re: setting up relationships
steve shapero 23:34 on 21 Jun 2004

Re: setting up relationships
Yuval Kogman 00:16 on 22 Jun 2004

Re: setting up relationships
steve shapero 06:34 on 22 Jun 2004

Re: setting up relationships
Tony Bowden 07:41 on 22 Jun 2004

Re: setting up relationships
steve shapero 17:28 on 22 Jun 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52