--- On Fri, 11/12/09, Rob Kinyon <[email protected]> wrote:

> From: Rob Kinyon <[email protected]>

> This looks to be the mythical "might_belong_to"
> relationship type that
> hasn't been defined yet. might_have is the LEFT JOIN
> version of
> has_many. What you want is belongs_to( ..., { join_type
> => 'LEFT' } );

>From DBIx::Class::RelationShip:

  might_have

  Arguments: $accessor_name, $related_class, 
$their_fk_column|\%cond|\...@cond?, \%attrs?
  Creates an optional one-to-one relationship with a class. 

That "one-to-one" is wrong?  Is this a doc error?  Ironically, our original 
code had "belongs_to", but it seemed a bit odd and was throwing the same error, 
so I changed it to "might_have" since (customer "might_have" account seemed 
natural).  

In the sample code I sent, changing "might_have" to "belongs_to" results in the 
same error:

The::Schema::Customer::account(): Unable to resolve relationship from Customer 
to account: column account.account_id not loaded from storage (or not passed to 
new() prior to insert()). Maybe you forgot to call ->discard_changes to get 
defaults from the db. at loader.pl line 37

Cheers,
Ovid
--
Buy the book         - http://www.oreilly.com/catalog/perlhks/
Tech blog            - http://use.perl.org/~Ovid/journal/
Twitter              - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6



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

Reply via email to