提交 a8637c8f 编写于 作者: C Carlos Antonio da Silva

Merge pull request #8765 from mmb/join_table_usage

Add join table migration generator to usage help. [ci skip]
......@@ -20,3 +20,16 @@ Example:
add_column :posts, :title, :string
add_column :posts, :body, :text
add_column :posts, :published, :boolean
Migration names containing JoinTable will generate join tables for use with
has_and_belongs_to_many associations.
Example:
`rails g migration CreateMediaJoinTable artists musics:uniq`
will create the migration
create_join_table :artists, :musics do |t|
# t.index [:artist_id, :music_id]
t.index [:music_id, :artist_id], unique: true
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册