Skip to content

Instantly share code, notes, and snippets.

@kernow
Created November 2, 2009 13:42
Show Gist options
  • Save kernow/224163 to your computer and use it in GitHub Desktop.
Save kernow/224163 to your computer and use it in GitHub Desktop.
class CreateGenresShows < ActiveRecord::Migration
def self.up
create_table :genres_shows, :id => false do |t|
t.integer :show_id
t.integer :genre_id
end
end
def self.down
drop_table :shows_genres
end
end
class Show < ActiveRecord::Base
has_and_belongs_to_many :genres
end
class Genre < ActiveRecord::Base
has_and_belongs_to_many :shows
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment