[Dbix-class] Difference between belongs_to and has_one
Drew Taylor
taylor.andrew.j at gmail.com
Sat Oct 21 00:03:12 CEST 2006
On 10/20/06, Jess Robinson <castaway at desert-island.demon.co.uk> wrote:
> belongs_to means: a field (or fields) in THIS table is a foreign key
> (contains the primary key of) THAT other table.
>
> has_one means: there is a row in THAT table which contains THIS tables
> primary key.
Thank you for that excellent explanation! I now get it. :-)
And to echo what Matt said, you can always change which columns are
used as the keys using explicit join conditions. The direction was the
important part for me.
Drew
--
----------------------------------------------------------------
Drew Taylor * Web development & consulting
Email: drew at drewtaylor.com * Site implementation & hosting
Web : www.drewtaylor.com * perl/mod_perl/DBI/mysql/postgres
----------------------------------------------------------------
More information about the Dbix-class
mailing list