我想实现一个游戏模型,它有两个团队和两个分数。团队是玩家的列表。
class Game < ActiveRecord::Base
has_many :players, :name => 'Team1' # I'd like this to be the first team
has_many :players, :name => 'Team2' # and this to be the second team
attr_accessible :score1 #the first team's score
attr_accessible :score2 #the second team's score
end
class Player < ActiveRecord::Base
attr_accessible :name
end
任何解决方案来实现这一点?我不知道这是否/如何可能。谢谢!