Skip to content

Instantly share code, notes, and snippets.

@gregbell
Created March 24, 2009 22:08
Show Gist options
  • Save gregbell/84393 to your computer and use it in GitHub Desktop.
Save gregbell/84393 to your computer and use it in GitHub Desktop.
class Player < ActiveRecord::Base
has_many :game_participations
has_many :games, :through => :game_participations
end
class Game < ActiveRecord::Base
has_many :game_participations
has_many :players, :through => :game_participations
end
# Table Schema
# game_id => integer
# player_id => integer
# points => integer
class GameParticipation < ActiveRecord::Base
belongs_to :game
belongs_to :player
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment