005_create_articles_tags.rb
public ruby v1 · immutable# in db/migrateclass CreateArticlesTags < ActiveRecord::Migration def self.up create_table :articles_tags do |t| t.integer :article_id t.integer :tag_id end end def self.down drop_table :articles_tags endend# in app/models/article.rbclass Article < ActiveRecord::Base has_and_belongs_to_many :tagsend# in app/models/tag.rbclass Tag < ActiveRecord::Base has_and_belongs_to_many :articlesend