Re: multi-column PK and has_many

[prev] [thread] [next] [Date index for 2005/04/20]

From: Perrin Harkins
Subject: Re: multi-column PK and has_many
Date: 18:41 on 20 Apr 2005
On Wed, 2005-04-20 at 12:21 -0600, Barry Moore wrote:
> Also a has_a/has_many tries to inflate the ta_id in the Table B 
> object and that's a bad thing.

Delcaring has_a() relationships on any column in your primary key can
cause problems.

> I want to be able to return an instance 
> of Table B, but with only a limited number of it's fields, but has_many 
> doesn't seem to offer me the option of listing @feilds_to_import like 
> might_have does - Music::CD->might_have(method_name => Class => 
> (@fields_to_import));

It doesn't make sense to import them.  The has_many() call will fetch a
list of the primary keys of table B where it references the current
object in tale A.  You can control how columns get loaded using the
normal column grouping stuff in Class::DBI. 

> #Recode::SeqFeature->has_many(seqfeature_qvs => [Recode::SeqFeature_QV 
> => 'term_id']);

If you do that, you won't get anything from table B at all.  It sounds
like you should be loading Recode::SeqFeature_QV objects here, so you
can fetch their additional fields rather going straight to your
Recode::Term object.

- Perrin

(message missing)

how to switch a view easily?
merlyn (Randal L. Schwartz) 04:21 on 20 Apr 2005

Re: how to switch a view easily?
merlyn (Randal L. Schwartz) 05:11 on 20 Apr 2005

Re: how to switch a view easily?
Tony Bowden 08:26 on 20 Apr 2005

Re: how to switch a view easily?
Dana Hudes 12:07 on 20 Apr 2005

Re: how to switch a view easily?
Mark Addison 13:12 on 20 Apr 2005

Re: how to switch a view easily?
merlyn (Randal L. Schwartz) 13:55 on 20 Apr 2005

Solved (thank you postgresql!) was Re: how to switch a view easily?
merlyn (Randal L. Schwartz) 16:30 on 20 Apr 2005

multi-column PK and has_many
Barry Moore 18:21 on 20 Apr 2005

Re: multi-column PK and has_many
Perrin Harkins 18:41 on 20 Apr 2005

Re: Solved (thank you postgresql!) was Re: how to switch a view easily?
merlyn (Randal L. Schwartz) 17:10 on 20 Apr 2005

Generated at 09:29 on 27 Apr 2005 by mariachi v0.52