Migration example for a join table
Posted by Jeff Kupperman Fri, 28 Sep 2007 15:15:24 GMT
... because I will forget again:
class GamesUsers < ActiveRecord::Migration def self.up create_table :games_users, :id => false do |t| t.column :user_id, :integer t.column :game_id, :integer end add_index :games_users, [:user_id] add_index :games_users, [:game_id] end def self.down drop_table :games_users end end
Spread the word.
Jeff Kupperman supports RSS (Real Simple Syndication), and Trackbacks from other blogs.
Your Comments.
Leave your own response