Forum: Ruby on Rails How to choose foreign key side of one-to-one association?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
7b0233f71d74f7d0314de24aa65b7b5c?d=identicon&s=25 Leonid Raiz (lraiz)
on 2006-12-30 20:50
When designing a new RoR application are there some fundamental database
considerations for selecting which table should contain a foreign key
column of one-to-one relationship? Say, in my application I have Orders
and Invoices. Both belongs_to and has_one methods give me a way to
access the other side of association and I know that belongs_to goes
into a model that records the foreign key. But is there some line of
reasoning for selecting to store order_id in invoices table vs. storing
invoice_id in orders table?  Does it make much difference?
This topic is locked and can not be replied to.