diff options
author | Vijay Dev <vijaydev.cse@gmail.com> | 2013-06-14 00:58:11 +0530 |
---|---|---|
committer | Vijay Dev <vijaydev.cse@gmail.com> | 2013-06-14 00:58:11 +0530 |
commit | 7663149f72b5dba15a8e850e4072a016341e541c (patch) | |
tree | 000ab41a49232ea9d70934a8ad04ce21e895a176 /guides/source/migrations.md | |
parent | c78b4310cf2e2264461e639371de171e47cfc9d5 (diff) | |
download | rails-7663149f72b5dba15a8e850e4072a016341e541c.tar.gz rails-7663149f72b5dba15a8e850e4072a016341e541c.tar.bz2 rails-7663149f72b5dba15a8e850e4072a016341e541c.zip |
copy edits [ci skip]
Diffstat (limited to 'guides/source/migrations.md')
-rw-r--r-- | guides/source/migrations.md | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/guides/source/migrations.md b/guides/source/migrations.md index 194ae276ec..eb0cfd9451 100644 --- a/guides/source/migrations.md +++ b/guides/source/migrations.md @@ -366,26 +366,24 @@ create_join_table :products, :categories which creates a `categories_products` table with two columns called `category_id` and `product_id`. These columns have the option `:null` set to -`false` by default. - -You can pass the option `:table_name` with you want to customize the table -name. For example, +`false` by default. This can be overridden by specifying the `:column_options` +option. ```ruby -create_join_table :products, :categories, table_name: :categorization +create_join_table :products, :categories, column_options: {null: true} ``` -will create a `categorization` table. +will create the `product_id` and `category_id` with the `:null` option as +`true`. -For the two table columns, you can override the default `:null` option, or add -others, by specifying the `:column_options` option. For example, +You can pass the option `:table_name` with you want to customize the table +name. For example, ```ruby -create_join_table :products, :categories, column_options: {null: true} +create_join_table :products, :categories, table_name: :categorization ``` -will create the `product_id` and `category_id` with the `:null` option as -`true`. +will create a `categorization` table. `create_join_table` also accepts a block, which you can use to add indices (which are not created by default) or additional columns: |