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