I think that the one-to-one example, at the ActiveRecord::Associations::ClassMethods module, in the documentation about "Cardinality and associations", is confusing. The example refers to an office that belongs to one employer, and an employer that has one office, leaving the foreign key on the Office model pointing to the employee_id. Maybe the reversed example is much more natural and nearer to the reality: An employee belongs to an office (where he works), and the office has one employee, creating the office_id foreign key at the Employee model. This example also leaves the posibility for the database structure to grow to a multiple-employee office design easily, just by changing the has_one macro by has_many, without touching the database.
Ticket + patch at:
What do you think?