Displaying 2 results from an estimated 2 matches for "market_id".
2008 Jul 01
6
validates_associated & foreign keys
....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 markets(id) MATCH FULL ON DELETE RESTRICT,
CONSTRAINT FOREIGN KEY(area_cod...
2009 Oct 06
1
Problems Processing multiple form elements generated by javascript actions
...iple_models_one_form.pdf
I have 3 models: users, schedules and markets.
Users
has_many :schedules
has_many :markets, :through => :schedules
Markets
has_many :schedules
has_many :users, :through => :schedules
Schedules
belongs_to :users
belongs_to :markets
Schedules has columns user_id and market_id, but also has additional
columns: monday, tuesday, wednesday, thursday, friday, saturday,
sunday. These are booleans.
All the editing in my app happens from the user model. The list of
available markets are prepopulated in the app, and the user cannot add
new ones. On the user#edit view, I'...