Displaying 2 results from an estimated 2 matches for "primary_id".
Did you mean:
primary_gid
2006 Mar 15
1
Strange behaviour of dates
Imagine a crud app that tracks people applying for a loan, here is the
layout I have:
Mysql database:
create table apps (
id int auto_increment primary key,
primary_id int not null,
secondary_id int null,
constraint fk_primary_id foreign key(primary_id) references (contacts.id),
constraint fk_secondary_id foreign key(secondary_id) references
(contacts.id))
create table contacts (
Id int auto_increment primary key,
Name char not null,
Date_of_birth date not null)...
2006 Jan 04
1
Multiple Associations With The Same Object
I have a Company object which 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
ha...