search for: primary_contact

Displaying 1 result from an estimated 1 matches for "primary_contact".

2006 Jan 04
1
Multiple Associations With The Same Object
...has multiple Contacts (has_many/belongs_to) I would like one of the contacts to be the primary contact. What''s the best way to do this? Right now I have: create table companies ( id int not null auto_increment, name varchar(50) not null, primary_id int null, constraint fk_company_primary_contact foreign key (primary_id) references contacts(id), primary key (id) ); create table contacts ( id int not null auto_increment, name varchar(100) not null, company_id int not null, primary key (id) ); class Company < ActiveRecord::Base has_many :contacts has_one :primary_contact,...