提交 0dad3ed4 编写于 作者: S Sammy Larbi

Document JoinTable migration generator

上级 427544ed
......@@ -202,6 +202,25 @@ end
This migration will create a `user_id` column and appropriate index.
There is also a generator which will produce join tables if `JoinTable` is part of the name:
```bash
rails g migration CreateJoinTableCustomerProduct customer product
```
will produce the following migration:
```ruby
class CreateJoinTableCustomerProduct < ActiveRecord::Migration
def change
create_join_table :customers, :products do |t|
# t.index [:customer_id, :product_id]
# t.index [:product_id, :customer_id]
end
end
end
```
### Model Generators
The model and scaffold generators will create migrations appropriate for adding
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册