diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-01-05 04:03:01 -0800 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-01-05 04:03:01 -0800 |
commit | a8637c8f289717e44d08d8a47ed2a1ff8afcee9c (patch) | |
tree | fc02eff1a427eb26ee3eb466d87fac0f728de745 /railties/lib/rails | |
parent | 7a34e0b1bd7caf6fda99678b6feae0eacd9687b0 (diff) | |
parent | d60ed3d401b7b45c2debef561c2a7740eee1a511 (diff) | |
download | rails-a8637c8f289717e44d08d8a47ed2a1ff8afcee9c.tar.gz rails-a8637c8f289717e44d08d8a47ed2a1ff8afcee9c.tar.bz2 rails-a8637c8f289717e44d08d8a47ed2a1ff8afcee9c.zip |
Merge pull request #8765 from mmb/join_table_usage
Add join table migration generator to usage help. [ci skip]
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/rails/migration/USAGE | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/migration/USAGE b/railties/lib/rails/generators/rails/migration/USAGE index f340ed97f2..baf3d9894f 100644 --- a/railties/lib/rails/generators/rails/migration/USAGE +++ b/railties/lib/rails/generators/rails/migration/USAGE @@ -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 |