Skip to content

Instantly share code, notes, and snippets.

@a2f0
Created January 18, 2014 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a2f0/8496381 to your computer and use it in GitHub Desktop.
Save a2f0/8496381 to your computer and use it in GitHub Desktop.
Migration:
class CreateJoinTableCommandTag < ActiveRecord::Migration
def change
create_join_table :commands, :tags do |t|
# t.index [:command_id, :tag_id]
# t.index [:tag_id, :command_id]
end
end
end
Model:
class CommandTag < ActiveRecord::Base
belongs_to :command
belongs_to :tag
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment