Re: linking on differently-named foreign keys

[prev] [thread] [next] [Date index for 2005/02/14]

From: Edward J. Sabol
Subject: Re: linking on differently-named foreign keys
Date: 20:00 on 14 Feb 2005
> I see. Of course, I want to say Message->sender() as opposed to
> sender_id(), since it is returning an Account object, not a
> unique identifier... but I guess I do that by explicitly coding the
> sender() subroutine in the Message class, right?

You can. Or you can override the accessor_name() method.

sub accessor_name {
    # Override default accessor naming to avoid superfluous "_id" prefix.
    my($class,$column) = @_;
    $column =~ s/^(sender|receiver)_id/$1/;
    return $column;
}

(message missing)

linking on differently-named foreign keys
Ofer Nave 08:38 on 14 Feb 2005

Re: linking on differently-named foreign keys
Tony Bowden 08:47 on 14 Feb 2005

Re: linking on differently-named foreign keys
Tony Bowden 09:50 on 14 Feb 2005

Re: linking on differently-named foreign keys
Edward J. Sabol 20:00 on 14 Feb 2005

Generated at 17:31 on 15 Feb 2005 by mariachi v0.52