customer to addresses where an address type is used to denote the
:class_name => “Address”
Thanks for the response. While this option would certainly work, I
was hoping to avoid it for two reasons:
- Conceptually, the address belongs to the customer. I understand
that the belongs_to in this situation gets the keys right, but it
doesn’t really express the domain.
- I would like to avoid having the keys in the addresses table as I
can forsee similar relationships to other objects than customers.
The other two options I have been considering are:
- has_and_belongs_to_many with join models
- Polymorphic associations.
Both seem complicated as a solution. It seems like it would be so
much cleaner if the key for one-to-one relationship were in the parent
and not the child.