Skip to content
This repository
Browse code

Add join table migration generator to usage help.

  • Loading branch information...
commit d60ed3d401b7b45c2debef561c2a7740eee1a511 1 parent 28fd867
Matthew M. Boedicker authored January 04, 2013
13  railties/lib/rails/generators/rails/migration/USAGE
@@ -20,3 +20,16 @@ Example:
20 20
       add_column :posts, :title, :string
21 21
       add_column :posts, :body, :text
22 22
       add_column :posts, :published, :boolean
  23
+
  24
+Migration names containing JoinTable will generate join tables for use with
  25
+has_and_belongs_to_many associations.
  26
+
  27
+Example:
  28
+    `rails g migration CreateMediaJoinTable artists musics:uniq`
  29
+
  30
+    will create the migration
  31
+
  32
+    create_join_table :artists, :musics do |t|
  33
+      # t.index [:artist_id, :music_id]
  34
+      t.index [:music_id, :artist_id], unique: true
  35
+    end

0 notes on commit d60ed3d

Please sign in to comment.
Something went wrong with that request. Please try again.