Skip to content

Instantly share code, notes, and snippets.

@jpablobr
Created July 28, 2010 23:32
Show Gist options
  • Select an option

  • Save jpablobr/496738 to your computer and use it in GitHub Desktop.

Select an option

Save jpablobr/496738 to your computer and use it in GitHub Desktop.
create_table :articles_tags, :id => false do |t|
t.references :article, :tag
end
# article.rb
has_many :articles_tags
has_many :tags, :through => :articles_tags
# tag.rb
has_many :articles_tags
has_many :articles, :through => :articles_tags
# article_tag.rb
belongs_to :tag
belongs_to :article
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment