From 743d15bba182df80d003d205690ead988970299c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Sch=C3=BCtz?= Date: Wed, 20 Feb 2013 22:18:06 +0100 Subject: Add more documentation for create_join_table. Explain that it doesn't create indices by default and that it also has a block form. --- guides/source/migrations.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'guides') diff --git a/guides/source/migrations.md b/guides/source/migrations.md index c4fbae8925..d738d847e9 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -344,6 +344,16 @@ create_join_table :products, :categories, column_options: {null: true} will create the `product_id` and `category_id` with the `:null` option as `true`. +`create_join_table` also accepts a block, which you can use to add indices +(which are not created by default) or additional columns: + +```ruby +create_join_table :products, :categories do |t| + t.index :products + t.index :categories +end +``` + ### Changing Tables A close cousin of `create_table` is `change_table`, used for changing existing -- cgit v1.2.3