Displaying 1 result from an estimated 1 matches for "fk_listings_user".
2006 Mar 15
10
Scaffold with Foreign Key
...varchar(20) not null,
primary key (id)
) TYPE = InnoDB;
------------------------------
drop table if exists listings;
create table listings (
id int not null auto_increment,
user_id int not null,
description text not null,
constraint fk_listings_user foreign key (user_id) references users(id),
primary key (id)
) TYPE = InnoDB;
------------------------------
and in my User model i have the line:
has_many :listing
and in my Listing model i have the line:
belongs_to :user
I generate my scaffold:
ruby script\generate Scaffold User Useradmin
ruby...