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:

http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1328

What do you think?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to