Displaying 1 result from an estimated 1 matches for "area_codes_markets".
2008 Jul 01
6
validates_associated & foreign keys
...'m using:
JRuby 1.1
rails-2.0.2
activerecord-2.0.2
activerecord-jdbc-adapter-0.8.2
My tables in MySQL:
CREATE TABLE area_codes (
id INT UNSIGNED auto_increment primary key
...
);
CREATE TABLE markets (
id INT UNSIGNED auto_increment primary key,
...
);
CREATE TABLE area_codes_markets (
id INT UNSIGNED auto_increment primary key,
market_id INT UNSIGNED NOT NULL,
area_code_id INT UNSIGNED NOT NULL,
INDEX(market_id),
INDEX(area_code_id),
CONSTRAINT UNIQUE (market_id, area_code_id),
CONSTRAINT FOREIGN KEY(market_id)
REFERENCES mar...