I have two models:
Customer and Contact
Customers The table has columns :id, :firstName, :lastName
Contacts the table has columns :id, :cid, :hphone, :cphone
So, if the Customers table has data
1 Josh McDonnel
Then the contact table has the corresponding
5 1 947-245-2342 342-543-8585
What associations can I use here?
Will contact
belongs_to :customer, :foreign_key => "id", :class_name => "Customer"
What should the Customer class have?
Also, it looks simple find_byXXXif I want to get all the clients ( firstName, lastNameand the corresponding hphoneand cphone)
source
share