I have two tables books and categories.
I create a join table books_categories.
Now how to create couple primary key(book_id,category_id)
class BooksCategories < ActiveRecord::Migration
def self.up
create_table :books_categories,:id => false do |t|
t.integer :book_id
t.integer :category_id
end
end
…
end
I have two tables books and categories.
I create a join table books_categories.
Now how to create couple primary key(book_id,category_id)
class BooksCategories < ActiveRecord::Migration
def self.up
create_table :books_categories,:id => false do |t|
t.integer :book_id
t.integer :category_id
end
end
…
end
I believe by default rails will create a primary key for you
~ - You know you’ve been hacking too long when…
…you discover that you’re balancing your checkbook in octal.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org