Re: might_have , has_many request

[prev] [thread] [next] [Date index for 2005/03/01]

From: Peter Speltz
Subject: Re: might_have , has_many request
Date: 18:21 on 01 Mar 2005
--- Tony Bowden <tony-cdbitalk@xxxxx.xxx> wrote:

> On Mon, Feb 28, 2005 at 03:24:40PM -0800, Peter Speltz wrote:
> > One thing it doesn't look like you can provide the "foreign_key" ("third")
> > argument in your patch.  Just one more line of code in remap_args in the if
> > (ref $fkey eq "HASH") case would do it. 
> 
> Can you give a failing test case for this?
> 

Can't do it. It works. You guys are good. ONe thing that doesn't work is when
you say $obj->add_to_* without the constraint column , the constraint is not
filled in and that column gets default. Similaryly the constraint is not
enforced in an add_to_* call. 

I just tested this in my maypole app. Here's my code:

__PACKAGE__->has_many(computers => 'MyCDBI::Computer', 'cstmr_id',
{constraint=> [os => 'Linux']});

sub add_computers {
  my ($self, $r, $obj) = @_;
  my $puter = $obj->add_to_computers ( 
     { username => 'No_OS', pw => 'FAIL1' });
  # $puter->os is default "Windows XP" not "Linux". Should it be Linux????

  $puter =  $obj->add_to_computers ( { username => 'OSBad', pw => 'Windows, os
=> "Windows"} );
   # $puter->os is "Windows" not "Linux". Should it be????

  $r->objects([$obj->computers]); # Only Linux computers in list :)
  $r->redirect('/computer/list');
}





=====
pjs


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Sports - Sign up for Fantasy Baseball. 
http://baseball.fantasysports.yahoo.com/

(message missing)

might_have , has_many request
Peter Speltz 21:25 on 28 Feb 2005

Re: might_have , has_many request
Tony Bowden 22:08 on 28 Feb 2005

Re: might_have , has_many request
Peter Speltz 22:42 on 28 Feb 2005

Re: might_have , has_many request
Cees Hek 22:43 on 28 Feb 2005

Re: might_have , has_many request
Peter Speltz 23:24 on 28 Feb 2005

Re: might_have , has_many request
Tony Bowden 09:41 on 01 Mar 2005

Re: might_have , has_many request
Peter Speltz 18:21 on 01 Mar 2005

Re: might_have , has_many request
Tony Bowden 19:05 on 01 Mar 2005

Re: might_have , has_many request
Peter Speltz 19:27 on 01 Mar 2005

Re: might_have , has_many request
Tony Bowden 22:09 on 01 Mar 2005

Re: might_have , has_many request
Peter Speltz 22:51 on 01 Mar 2005

Re: might_have , has_many request
Tony Bowden 23:39 on 01 Mar 2005

Re: might_have , has_many request
Peter Speltz 01:45 on 05 Mar 2005

Generated at 20:12 on 07 Mar 2005 by mariachi v0.52