Ruby Migration >> Foreign Keys


#1

I have two tables having many-to-many relationship.
I created a join table containing the primary keys of both tables.

Can any body tell me how use
Ruby migration for foreign keys…

Thanks in advance
Satish


#2

Gladiator wrote:

I have two tables having many-to-many relationship.
I created a join table containing the primary keys of both tables.

Can any body tell me how use
Ruby migration for foreign keys…

Thanks in advance
Satish

Don’t know what you mean. Do you mean something like this:


create_table :magazines_readers, :id => false do |t|
t.column :magazine_id, :integer
t.column :reader_id, :integer
end

(see “Rails Recipes” pag. 104)

for a many-to-many relation between magazines and readers (a magazine
has many readers, a reader reads many magazines).

Roberto Gattinoni.